diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-02-28 19:54:42 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-02-28 19:58:45 +0900 |
commit | 42a16a4d6514f28e05f1c22a5f9125d194d9c7cb (patch) | |
tree | a0a393447e00b679dd93fa4350e873d5d3fb395f /activemodel/test/cases | |
parent | 761122a6caf5030db8d791ed7d9ebf7afac529a2 (diff) | |
download | rails-42a16a4d6514f28e05f1c22a5f9125d194d9c7cb.tar.gz rails-42a16a4d6514f28e05f1c22a5f9125d194d9c7cb.tar.bz2 rails-42a16a4d6514f28e05f1c22a5f9125d194d9c7cb.zip |
Alias `assign_attributes` to `attributes=` for `AttributeAssignment`
There is no reason `attributes=` doesn't take `assign_attributes`.
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/attribute_assignment_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activemodel/test/cases/attribute_assignment_test.rb b/activemodel/test/cases/attribute_assignment_test.rb index 448f8587fd..b06291f1b4 100644 --- a/activemodel/test/cases/attribute_assignment_test.rb +++ b/activemodel/test/cases/attribute_assignment_test.rb @@ -68,6 +68,14 @@ class AttributeAssignmentTest < ActiveModel::TestCase assert_equal "world", model.description end + test "simple assignment alias" do + model = Model.new + + model.attributes = { name: "hello", description: "world" } + assert_equal "hello", model.name + assert_equal "world", model.description + end + test "assign non-existing attribute" do model = Model.new error = assert_raises(ActiveModel::UnknownAttributeError) do |