Files
openfoodnetwork/spec/helpers/serializer_helper_spec.rb
2019-06-12 09:47:01 +01:00

19 lines
536 B
Ruby

require 'spec_helper'
describe SerializerHelper, type: :helper do
let(:serializer) do
class ExampleEnterpriseSerializer < ActiveModel::Serializer
attributes :id, :name
end
ExampleEnterpriseSerializer
end
describe "#required_attributes" do
it "returns only the attributes from the model that the serializer needs to be queried" do
required_attributes = helper.required_attributes Enterprise, serializer
expect(required_attributes).to eq ['enterprises.id', 'enterprises.name']
end
end
end