Don't modify existing test model in a test case
It will affect to other tests.
This commit is contained in:
parent
2fbb25b771
commit
4f2fa59734
@ -67,14 +67,13 @@ def test_token_length_cannot_be_less_than_24_characters
|
||||
end
|
||||
|
||||
def test_token_on_callback
|
||||
User.class_eval do
|
||||
undef regenerate_token
|
||||
|
||||
model = Class.new(ActiveRecord::Base) do
|
||||
self.table_name = "users"
|
||||
has_secure_token on: :initialize
|
||||
end
|
||||
|
||||
model = User.new
|
||||
user = model.new
|
||||
|
||||
assert_predicate model.token, :present?
|
||||
assert_predicate user.token, :present?
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user