Remove the assert_value_changed helper

It's only used in one place and it's easy enough to rewrite this into
something more straightforward and less clever.
This commit is contained in:
Matt Rogers 2018-10-17 21:22:13 -05:00
parent cf6f9de377
commit bb8fd08685
No known key found for this signature in database
GPG key ID: 605D017C07EB4316
2 changed files with 3 additions and 9 deletions

View file

@ -160,9 +160,9 @@ class UserTest < ActiveSupport::TestCase
end
def test_generate_token_updates_token
assert_value_changed @admin_user, :token do
@admin_user.send :generate_token
end
old_token = @admin_user.token
@admin_user.generate_token
assert_not_equal old_token, @admin_user.token
end
def test_find_admin

View file

@ -33,12 +33,6 @@ class ActiveSupport::TestCase
@thursday = Time.zone.local(2008,6,12)
end
# Add more helper methods to be used by all tests here...
def assert_value_changed(object, method = nil)
initial_value = object.send(method)
yield
assert_not_equal initial_value, object.send(method), "#{object}##{method}"
end
# Generates a random string of ascii characters (a-z, "1 0")
# of a given length for testing assignment to fields
# for validation purposes