mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Add auto-stripping of question mark for attributes
This commit is contained in:
@@ -36,6 +36,22 @@ module ActiveModel
|
||||
assert_equal([:name, :description],
|
||||
another_inherited_serializer_klass._attributes)
|
||||
end
|
||||
|
||||
def tests_query_attributes_strip_question_mark
|
||||
model = Class.new(::Model) do
|
||||
def strip?
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
serializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :strip?
|
||||
end
|
||||
|
||||
actual = serializer.new(model.new).as_json
|
||||
|
||||
assert_equal({ strip: true }, actual)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user