diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-05-18 21:47:24 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-19 10:18:36 +0200 |
commit | b4629528866446aa59f663a1162edbdacee85600 (patch) | |
tree | d68a0f440d552285adf99b462b8bde39d346aaa6 /activemodel | |
parent | b753b4a076d7067efccbd1ad384829f77e62a064 (diff) | |
download | rails-b4629528866446aa59f663a1162edbdacee85600.tar.gz rails-b4629528866446aa59f663a1162edbdacee85600.tar.bz2 rails-b4629528866446aa59f663a1162edbdacee85600.zip |
Use better assertion methods for testing
[#4645 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/test/cases/attribute_methods_test.rb | 2 | ||||
-rw-r--r-- | activemodel/test/cases/callbacks_test.rb | 2 | ||||
-rw-r--r-- | activemodel/test/cases/dirty_test.rb | 4 | ||||
-rw-r--r-- | activemodel/test/cases/serializeration/xml_serialization_test.rb | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/activemodel/test/cases/attribute_methods_test.rb b/activemodel/test/cases/attribute_methods_test.rb index 5659dcbc48..c60caf90d7 100644 --- a/activemodel/test/cases/attribute_methods_test.rb +++ b/activemodel/test/cases/attribute_methods_test.rb @@ -31,7 +31,7 @@ class AttributeMethodsTest < ActiveModel::TestCase ModelWithAttributes.define_attribute_methods([:foo]) assert ModelWithAttributes.attribute_methods_generated? - assert ModelWithAttributes.new.respond_to?(:foo) + assert_respond_to ModelWithAttributes.new, :foo assert_equal "value of foo", ModelWithAttributes.new.foo end diff --git a/activemodel/test/cases/callbacks_test.rb b/activemodel/test/cases/callbacks_test.rb index b996f51d6b..9675b5d450 100644 --- a/activemodel/test/cases/callbacks_test.rb +++ b/activemodel/test/cases/callbacks_test.rb @@ -65,6 +65,6 @@ class CallbacksTest < ActiveModel::TestCase test "only selects which types of callbacks should be created" do assert !ModelCallbacks.respond_to?(:before_initialize) assert !ModelCallbacks.respond_to?(:around_initialize) - assert ModelCallbacks.respond_to?(:after_initialize) + assert_respond_to ModelCallbacks, :after_initialize end end diff --git a/activemodel/test/cases/dirty_test.rb b/activemodel/test/cases/dirty_test.rb index c910cb43d4..e1a35be384 100644 --- a/activemodel/test/cases/dirty_test.rb +++ b/activemodel/test/cases/dirty_test.rb @@ -22,8 +22,8 @@ class DirtyTest < ActiveModel::TestCase test "changes accessible through both strings and symbols" do model = DirtyModel.new model.name = "David" - assert !model.changes[:name].nil? - assert !model.changes['name'].nil? + assert_not_nil model.changes[:name] + assert_not_nil model.changes['name'] end end diff --git a/activemodel/test/cases/serializeration/xml_serialization_test.rb b/activemodel/test/cases/serializeration/xml_serialization_test.rb index 4e8e4efa25..7b9ef3e21f 100644 --- a/activemodel/test/cases/serializeration/xml_serialization_test.rb +++ b/activemodel/test/cases/serializeration/xml_serialization_test.rb @@ -69,7 +69,7 @@ class XmlSerializationTest < ActiveModel::TestCase test "should allow skipped types" do @xml = @contact.to_xml :skip_types => true - assert %r{<age>25</age>}.match(@xml) + assert_match %r{<age>25</age>}, @xml end test "should include yielded additions" do |