Files
openfoodnetwork/spec/helpers/serializer_helper_spec.rb
Maikel Linke dcb6f4676d Remove all unnecessary spec_helper require statements
The `.rspec` file is doing this for us.
2026-01-21 12:35:34 +11:00

18 lines
481 B
Ruby

# frozen_string_literal: true
RSpec.describe SerializerHelper do
let(:serializer) do
Class.new(ActiveModel::Serializer) do
attributes :id, :name
end
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