mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Add specs to cover the most important new fields in api/admin/variant_serializer
This commit is contained in:
@@ -1,7 +1,30 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Api::Admin::VariantSerializer do
|
||||
|
||||
let(:variant) { create(:variant) }
|
||||
it "serializes a variant" do
|
||||
|
||||
it "serializes the variant name" do
|
||||
serializer = Api::Admin::VariantSerializer.new variant
|
||||
|
||||
expect(serializer.to_json).to match variant.name
|
||||
end
|
||||
|
||||
it "serializes the variant options" do
|
||||
serializer = Api::Admin::VariantSerializer.new variant
|
||||
|
||||
expect(serializer.to_json).to match variant.options_text
|
||||
end
|
||||
|
||||
it "serializes the variant full name" do
|
||||
serializer = Api::Admin::VariantSerializer.new variant
|
||||
|
||||
expect(serializer.to_json).to match variant.full_name
|
||||
end
|
||||
|
||||
it "serializes the variant stock location id" do
|
||||
serializer = Api::Admin::VariantSerializer.new variant
|
||||
|
||||
expect(serializer.to_json).to match variant.stock_items.first.stock_location.id.to_s
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user