As the project has been renamed, its better to reflect it in the source code as well. JSONAPI::Serializer is evaluated from FastJsonapi::ObjectSerializer so this change probably will go unnoticed in gem usage.
26 lines
506 B
Ruby
26 lines
506 B
Ruby
require 'spec_helper'
|
|
|
|
RSpec.describe JSONAPI::Serializer do
|
|
let(:user) { User.fake }
|
|
let(:params) { {} }
|
|
let(:serialized) do
|
|
UserSerializer.new(user, params).serializable_hash.as_json
|
|
end
|
|
|
|
it do
|
|
expect(serialized['data']).to have_meta('email_length' => user.email.size)
|
|
end
|
|
|
|
context 'with root meta' do
|
|
let(:params) do
|
|
{
|
|
meta: { 'code' => FFaker::Internet.password }
|
|
}
|
|
end
|
|
|
|
it do
|
|
expect(serialized).to have_meta(params[:meta])
|
|
end
|
|
end
|
|
end
|