Sha256: 2b5d83196158a0a4ce1699b75afc1aad7a11cbfee6ac839383837e2ee6e18e83

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

describe Spree::ProductSerializer do
  let(:image) { create :image }
  let(:product) { create :product }
  subject { ActiveModel::Serializer::Adapter::JsonApi.new(described_class.new product) }

  before { product.images << image }

  its(:to_json) do
    is_expected.to be_json_eql <<-JSON
      {
        "data" : {
          "attributes" : {
            "description" : #{product.description.to_json},
            "meta_description" : null,
            "meta_keywords" : null,
            "name" : "#{product.name}",
            "slug" : "#{product.slug}"
          },
          "relationships" : {
            "images" : {
              "data" : [
                {
                  "type" : "spree_images"
                }
              ]
            },
            "master" : {
              "data" : {
                "type" : "spree_variants"
              }
            },
            "option_types" : {
              "data" : []
            },
            "taxons" : {
              "data" : []
            },
            "variants" : {
              "data" : []
            }
          },
          "type" : "spree_products"
        }
      }
    JSON
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
solidus_json_api-0.3.1 spec/serializers/spree/product_serializer_spec.rb
solidus_json_api-0.3.0 spec/serializers/spree/product_serializer_spec.rb
spree_api_v2-0.2.2 spec/serializers/spree/product_serializer_spec.rb
solidus_api_v2-0.2.2 spec/serializers/spree/product_serializer_spec.rb
solidus_api_v2-0.2.1 spec/serializers/spree/product_serializer_spec.rb
spree_api_v2-0.2.1 spec/serializers/spree/product_serializer_spec.rb
spree_api_v2-0.2.0 spec/serializers/spree/product_serializer_spec.rb
solidus_api_v2-0.2.0 spec/serializers/spree/product_serializer_spec.rb