mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Return empty hash when url_options not provided
This commit is contained in:
parent
dd5cdb6ddb
commit
754aa295ba
@ -449,7 +449,7 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def url_options
|
||||
@options[:url_options]
|
||||
@options[:url_options] || {}
|
||||
end
|
||||
|
||||
# Returns a json representation of the serializable
|
||||
|
||||
@ -143,6 +143,12 @@ class SerializerTest < ActiveModel::TestCase
|
||||
assert_equal({ :host => "test.local" }, user_serializer.url_options)
|
||||
end
|
||||
|
||||
def test_serializer_returns_empty_hash_without_url_options
|
||||
user = User.new
|
||||
user_serializer = UserSerializer.new(user)
|
||||
assert_equal({}, user_serializer.url_options)
|
||||
end
|
||||
|
||||
def test_pretty_accessors
|
||||
user = User.new
|
||||
user.superuser = true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user