Run transpec in spec/serializers

This commit is contained in:
luisramos0
2019-05-09 22:43:07 +01:00
parent 04801e5c2e
commit fe017713ae
5 changed files with 15 additions and 15 deletions

View File

@@ -4,7 +4,7 @@ describe Api::Admin::EnterpriseSerializer do
let(:enterprise) { create(:distributor_enterprise) }
it "serializes an enterprise" do
serializer = Api::Admin::EnterpriseSerializer.new enterprise
serializer.to_json.should match enterprise.name
expect(serializer.to_json).to match enterprise.name
end
context "for logo" do

View File

@@ -12,7 +12,7 @@ describe Api::Admin::IndexEnterpriseSerializer do
it "sets 'owned' to false" do
serializer = Api::Admin::IndexEnterpriseSerializer.new enterprise, spree_current_user: user
serializer.to_json.should match "\"owned\":false"
expect(serializer.to_json).to match "\"owned\":false"
end
end
@@ -21,7 +21,7 @@ describe Api::Admin::IndexEnterpriseSerializer do
it "sets 'owned' to true" do
serializer = Api::Admin::IndexEnterpriseSerializer.new enterprise, spree_current_user: user
serializer.to_json.should match "\"owned\":true"
expect(serializer.to_json).to match "\"owned\":true"
end
end
@@ -30,7 +30,7 @@ describe Api::Admin::IndexEnterpriseSerializer do
it "sets 'owned' to true" do
serializer = Api::Admin::IndexEnterpriseSerializer.new enterprise, spree_current_user: user
serializer.to_json.should match "\"owned\":true"
expect(serializer.to_json).to match "\"owned\":true"
end
end
end

View File

@@ -7,9 +7,9 @@ describe Api::Admin::VariantOverrideSerializer do
it "serializes a variant override" do
serializer = Api::Admin::VariantOverrideSerializer.new variant_override
serializer.to_json.should match variant.id.to_s
serializer.to_json.should match hub.id.to_s
serializer.to_json.should match price.to_s
serializer.to_json.should match count_on_hand.to_s
expect(serializer.to_json).to match variant.id.to_s
expect(serializer.to_json).to match hub.id.to_s
expect(serializer.to_json).to match price.to_s
expect(serializer.to_json).to match count_on_hand.to_s
end
end

View File

@@ -14,20 +14,20 @@ describe Api::EnterpriseSerializer do
}
it "serializes an enterprise" do
serializer.to_json.should match enterprise.name
expect(serializer.to_json).to match enterprise.name
end
it "serializes taxons as ids only" do
serializer.serializable_hash[:taxons].should == [{id: 123}]
serializer.serializable_hash[:supplied_taxons].should == [{id: 456}]
expect(serializer.serializable_hash[:taxons]).to eq([{id: 123}])
expect(serializer.serializable_hash[:supplied_taxons]).to eq([{id: 456}])
end
it "serializes producers and hubs as ids only" do
serializer.serializable_hash[:producers].should == [{id: 123}]
serializer.serializable_hash[:hubs].should == [{id: 456}]
expect(serializer.serializable_hash[:producers]).to eq([{id: 123}])
expect(serializer.serializable_hash[:hubs]).to eq([{id: 456}])
end
it "serializes icons" do
serializer.to_json.should match "map_005-hub.svg"
expect(serializer.to_json).to match "map_005-hub.svg"
end
end

View File

@@ -2,6 +2,6 @@ describe Api::Admin::VariantSerializer do
let(:variant) { create(:variant) }
it "serializes a variant" do
serializer = Api::Admin::VariantSerializer.new variant
serializer.to_json.should match variant.options_text
expect(serializer.to_json).to match variant.options_text
end
end