Implement Devise::Models::Authenticatable#inspect, re-using #serializable_hash.

This commit is contained in:
Tim Krajcar
2016-06-03 15:10:28 -07:00
parent bcdd54cc5e
commit a0232cf763
3 changed files with 16 additions and 0 deletions

View File

@@ -35,6 +35,11 @@ class SerializableTest < ActiveSupport::TestCase
assert_key "confirmation_token", from_json(force_except: :email)
end
test 'should not include unsafe keys in inspect' do
assert_match(/email/, @user.inspect)
assert_no_match(/confirmation_token/, @user.inspect)
end
def assert_key(key, subject)
assert subject.key?(key), "Expected #{subject.inspect} to have key #{key.inspect}"
end