Improved test for variant serializer

This commit is contained in:
Duende13
2017-06-26 23:11:45 +10:00
committed by Rob Harrington
parent a07fd854f6
commit 705295049e

View File

@@ -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