mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-10 07:18:14 -05:00
Allow frozen options in as_json (#4655)
The test uses `as_json` instead of `to_json` because `to_json` does `#dup` on `options` before it reaches `#serializable_hash` and the test would pass without the fix.
This commit is contained in:
committed by
Leonardo Tegon
parent
1b02534bef
commit
8b9fba73fd
@@ -40,6 +40,10 @@ class SerializableTest < ActiveSupport::TestCase
|
||||
assert_no_match(/confirmation_token/, @user.inspect)
|
||||
end
|
||||
|
||||
test 'should accept frozen options' do
|
||||
assert_key "username", @user.as_json({only: :username}.freeze)["user"]
|
||||
end
|
||||
|
||||
def assert_key(key, subject)
|
||||
assert subject.key?(key), "Expected #{subject.inspect} to have key #{key.inspect}"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user