@@ -30,14 +30,15 @@ def self.lookup_ancestors
3030 def test_delete
3131 errors = ActiveModel ::Errors . new ( self )
3232 errors [ :foo ] << "omg"
33- errors . delete ( : foo)
33+ errors . delete ( " foo" )
3434 assert_empty errors [ :foo ]
3535 end
3636
3737 def test_include?
3838 errors = ActiveModel ::Errors . new ( self )
3939 errors [ :foo ] << "omg"
4040 assert_includes errors , :foo , "errors should include :foo"
41+ assert_includes errors , "foo" , "errors should include 'foo' as :foo"
4142 end
4243
4344 def test_dup
@@ -52,6 +53,7 @@ def test_has_key?
5253 errors = ActiveModel ::Errors . new ( self )
5354 errors [ :foo ] << "omg"
5455 assert_equal true , errors . has_key? ( :foo ) , "errors should have key :foo"
56+ assert_equal true , errors . has_key? ( "foo" ) , "errors should have key 'foo' as :foo"
5557 end
5658
5759 def test_has_no_key
@@ -63,6 +65,7 @@ def test_key?
6365 errors = ActiveModel ::Errors . new ( self )
6466 errors [ :foo ] << "omg"
6567 assert_equal true , errors . key? ( :foo ) , "errors should have key :foo"
68+ assert_equal true , errors . key? ( "foo" ) , "errors should have key 'foo' as :foo"
6669 end
6770
6871 def test_no_key
@@ -150,10 +153,11 @@ def test_no_key
150153 assert_equal [ "cannot be blank" ] , person . errors [ :name ]
151154 end
152155
153- test "added? detects if a specific error was added to the object" do
156+ test "added? detects indifferent if a specific error was added to the object" do
154157 person = Person . new
155158 person . errors . add ( :name , "cannot be blank" )
156159 assert person . errors . added? ( :name , "cannot be blank" )
160+ assert person . errors . added? ( "name" , "cannot be blank" )
157161 end
158162
159163 test "added? handles symbol message" do
@@ -241,7 +245,7 @@ def test_no_key
241245 assert_equal [ "name cannot be blank" , "name cannot be nil" ] , person . errors . full_messages
242246 end
243247
244- test "full_messages_for contains all the error messages for the given attribute" do
248+ test "full_messages_for contains all the error messages for the given attribute indifferent " do
245249 person = Person . new
246250 person . errors . add ( :name , "cannot be blank" )
247251 person . errors . add ( :name , "cannot be nil" )
@@ -253,6 +257,7 @@ def test_no_key
253257 person . errors . add ( :name , "cannot be blank" )
254258 person . errors . add ( :email , "cannot be blank" )
255259 assert_equal [ "name cannot be blank" ] , person . errors . full_messages_for ( :name )
260+ assert_equal [ "name cannot be blank" ] , person . errors . full_messages_for ( "name" )
256261 end
257262
258263 test "full_messages_for returns an empty list in case there are no errors for the given attribute" do
0 commit comments