Permalink
Browse files

Make use of assert_equal to test equallity between object assert expe…

…cts and object and a message of error

[#4611 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
spastorino authored and josevalim committed May 16, 2010
1 parent d7a3e65 commit fdfebb7782a399839ac9a9e63d5153565d6f88f4
@@ -45,7 +45,7 @@ def test_validates_with_if_as_shared_conditions
Person.validates :karma, :presence => true, :email => true, :if => :condition_is_true
person = Person.new
person.valid?
- assert ["can't be blank", "is not an email"], person.errors[:karma].sort
+ assert_equal ["can't be blank", "is not an email"], person.errors[:karma].sort
end
def test_validates_with_unless_shared_conditions
@@ -111,4 +111,4 @@ def test_validates_with_included_validator_and_options
person.valid?
assert_equal ['Local validator please'], person.errors[:title]
end
-end
+end
@@ -228,7 +228,7 @@ def test_validation_with_message_as_proc
t = Topic.new
assert t.invalid?
- assert ["NO BLANKS HERE"], t.errors[:title]
+ assert_equal ["NO BLANKS HERE"], t.errors[:title]
end
def test_list_of_validators_for_model
@@ -289,7 +289,7 @@ def test_has_many_class_methods_called_by_method_missing
end
def test_has_many_array_methods_called_by_method_missing
- assert true, authors(:david).categories.any? { |category| category.name == 'General' }
+ assert authors(:david).categories.any? { |category| category.name == 'General' }
assert_nothing_raised { authors(:david).categories.sort }
end
@@ -765,7 +765,7 @@ def test_should_still_work_without_an_associated_model
@ship.destroy
@pirate.reload.catchphrase = "Arr"
@pirate.save
- assert 'Arr', @pirate.reload.catchphrase
+ assert_equal 'Arr', @pirate.reload.catchphrase
end
def test_should_automatically_save_the_associated_model
@@ -885,7 +885,7 @@ def test_should_still_work_without_an_associated_model
@pirate.destroy
@ship.reload.name = "The Vile Insanity"
@ship.save
- assert 'The Vile Insanity', @ship.reload.name
+ assert_equal 'The Vile Insanity', @ship.reload.name
end
def test_should_automatically_save_the_associated_model
@@ -722,10 +722,10 @@ def test_find_all_by_two_attributes_with_one_being_an_aggregate
def test_find_all_by_one_attribute_with_options
topics = Topic.find_all_by_content("Have a nice day", :order => "id DESC")
- assert topics(:first), topics.last
+ assert_equal topics(:first), topics.last
topics = Topic.find_all_by_content("Have a nice day", :order => "id")
- assert topics(:first), topics.first
+ assert_equal topics(:first), topics.first
end
def test_find_all_by_array_attribute
@@ -73,7 +73,7 @@ def test_should_not_mutate_message
end
@logger.flush
- assert !@output.string.empty?, @logger.send(:buffer).size
+ assert !@output.string.empty?, @logger.send(:buffer).size.to_s
end
define_method "test_disabling_auto_flush_with_#{disable.inspect}_should_flush_at_max_buffer_size_as_failsafe" do
@@ -86,7 +86,7 @@ def test_should_not_mutate_message
end
@logger.info 'there it is.'
- assert !@output.string.empty?, @logger.send(:buffer).size
+ assert !@output.string.empty?, @logger.send(:buffer).size.to_s
end
end
@@ -375,7 +375,7 @@ def test_local_cache_of_read
def test_local_cache_of_write_nil
@cache.with_local_cache do
- assert true, @cache.write('foo', nil)
+ assert @cache.write('foo', nil)
assert_nil @cache.read('foo')
@peek.write('foo', 'bar')
assert_nil @cache.read('foo')
@@ -394,7 +394,7 @@ def test_local_cache_of_exist
@cache.with_local_cache do
@cache.write('foo', 'bar')
@peek.delete('foo')
- assert true, @cache.exist?('foo')
+ assert @cache.exist?('foo')
end
end

0 comments on commit fdfebb7

Please sign in to comment.