mirror of
https://github.com/samsonjs/grape-active_model_serializers.git
synced 2026-03-25 08:45:55 +00:00
add spec for default_serializer_options.
This commit is contained in:
parent
cfb80be11e
commit
a2578f893d
1 changed files with 10 additions and 1 deletions
|
|
@ -41,6 +41,10 @@ describe Grape::Formatter::ActiveModelSerializers do
|
|||
def endpoint.current_user
|
||||
@current_user ||= User.new(first_name: 'Current user')
|
||||
end
|
||||
|
||||
def endpoint.default_serializer_options
|
||||
{ only: :only, except: :except }
|
||||
end
|
||||
end
|
||||
|
||||
subject { described_class.fetch_serializer(user, env) }
|
||||
|
|
@ -48,7 +52,12 @@ describe Grape::Formatter::ActiveModelSerializers do
|
|||
it { should be_a UserSerializer }
|
||||
|
||||
it 'should have correct scope set' do
|
||||
expect(subject.scope).to eq(endpoint.current_user)
|
||||
expect(subject.scope.current_user).to eq(endpoint.current_user)
|
||||
end
|
||||
|
||||
it 'should read default serializer options' do
|
||||
expect(subject.instance_variable_get('@only')).to eq([:only])
|
||||
expect(subject.instance_variable_get('@except')).to eq([:except])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue