From 3dbf2e5646d6b769c6392cdb71003d0f4aee2304 Mon Sep 17 00:00:00 2001
From: Elliot Winkler <elliot.winkler@gmail.com>
Date: Mon, 24 Jul 2017 22:20:00 -0500
Subject: [PATCH] Rails 5: Fix built-in-test custom models w/ attrs
When a model was built in a unit test and it was configured to have
attributes, when those attributes are set later, the test would blow up
because we were not using `write_attribute` correctly.
---
spec/support/unit/model_creators/basic.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spec/support/unit/model_creators/basic.rb b/spec/support/unit/model_creators/basic.rb
index c2fded58..3791fd83 100644
--- a/spec/support/unit/model_creators/basic.rb
+++ b/spec/support/unit/model_creators/basic.rb
@@ -80,7 +80,7 @@ def possibly_override_attribute_writer_method_for(model)
)
if respond_to?(:write_attribute)
- write_attribute(new_value)
+ write_attribute(attribute_name, new_value)
else
super(new_value)
end