mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-08 22:56:06 +00:00
Improved test for variant serializer
This commit is contained in:
@@ -1,13 +1,27 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Api::VariantSerializer do
|
||||
let(:serializer) { Api::VariantSerializer.new variant }
|
||||
|
||||
subject { Api::VariantSerializer.new variant }
|
||||
let(:variant) { create(:variant) }
|
||||
|
||||
|
||||
it "serializes a variant" do
|
||||
expect(serializer.to_json).to match variant.id.to_s
|
||||
it "includes the expected attributes " do
|
||||
expect(subject.attributes.keys).
|
||||
to include(
|
||||
:id,
|
||||
:name_to_display,
|
||||
:is_master,
|
||||
:count_on_hand,
|
||||
:name_to_display,
|
||||
:unit_to_display,
|
||||
:unit_value,
|
||||
:options_text,
|
||||
:on_demand,
|
||||
:price,
|
||||
:fees,
|
||||
:price_with_fees,
|
||||
:product_name
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user