Skip to content

Commit

Permalink
Make use of assert_equal to test equallity between object assert expe…
Browse files Browse the repository at this point in the history
…cts and object and a message of error

[rails#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 fdfebb7
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions activemodel/test/cases/validations/validates_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion activemodel/test/cases/validations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/associations/join_model_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/autosave_association_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/finder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions activesupport/test/buffered_logger_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions activesupport/test/caching_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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

Expand Down

0 comments on commit fdfebb7

Please sign in to comment.