diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-05-19 15:14:51 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-19 21:31:51 +0200 |
commit | 39a246f545a714b21c669e2f6eda4012526c3874 (patch) | |
tree | 89da32733821f0a7dcc56efdac82c72897eca424 /activesupport/test/core_ext/class | |
parent | bdb2871df7fb0a1eeceadb31aaba4d160df508aa (diff) | |
download | rails-39a246f545a714b21c669e2f6eda4012526c3874.tar.gz rails-39a246f545a714b21c669e2f6eda4012526c3874.tar.bz2 rails-39a246f545a714b21c669e2f6eda4012526c3874.zip |
Final iteration of use better testing methods
[#4652 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport/test/core_ext/class')
3 files changed, 10 insertions, 10 deletions
diff --git a/activesupport/test/core_ext/class/attribute_accessor_test.rb b/activesupport/test/core_ext/class/attribute_accessor_test.rb index 0f579d12e5..2c896d0cdb 100644 --- a/activesupport/test/core_ext/class/attribute_accessor_test.rb +++ b/activesupport/test/core_ext/class/attribute_accessor_test.rb @@ -25,14 +25,14 @@ class ClassAttributeAccessorTest < Test::Unit::TestCase end def test_should_not_create_instance_writer - assert @class.respond_to?(:foo) - assert @class.respond_to?(:foo=) - assert @object.respond_to?(:bar) + assert_respond_to @class, :foo + assert_respond_to @class, :foo= + assert_respond_to @object, :bar assert !@object.respond_to?(:bar=) end def test_should_not_create_instance_reader - assert @class.respond_to?(:shaq) + assert_respond_to @class, :shaq assert !@object.respond_to?(:shaq) end end diff --git a/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb b/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb index eeda468d9c..63ea46b564 100644 --- a/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb +++ b/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb @@ -219,7 +219,7 @@ class ClassInheritableAttributesTest < Test::Unit::TestCase @klass.reset_inheritable_attributes @sub = eval("class NotInheriting < @klass; end; NotInheriting") - assert_equal nil, @klass.a - assert_equal nil, @sub.a + assert_nil @klass.a + assert_nil @sub.a end end diff --git a/activesupport/test/core_ext/class/delegating_attributes_test.rb b/activesupport/test/core_ext/class/delegating_attributes_test.rb index 6d6cb61571..cbfb290c48 100644 --- a/activesupport/test/core_ext/class/delegating_attributes_test.rb +++ b/activesupport/test/core_ext/class/delegating_attributes_test.rb @@ -32,16 +32,16 @@ class DelegatingAttributesTest < Test::Unit::TestCase single_class.superclass_delegating_accessor :both # Class should have accessor and mutator # the instance should have an accessor only - assert single_class.respond_to?(:both) - assert single_class.respond_to?(:both=) + assert_respond_to single_class, :both + assert_respond_to single_class, :both= assert single_class.public_instance_methods.map(&:to_s).include?("both") assert !single_class.public_instance_methods.map(&:to_s).include?("both=") end def test_simple_accessor_declaration_with_instance_reader_false single_class.superclass_delegating_accessor :no_instance_reader, :instance_reader => false - assert single_class.respond_to?(:no_instance_reader) - assert single_class.respond_to?(:no_instance_reader=) + assert_respond_to single_class, :no_instance_reader + assert_respond_to single_class, :no_instance_reader= assert !single_class.public_instance_methods.map(&:to_s).include?("no_instance_reader") end |