Sha256: b29a5b6e13c9aba31ff1d3f75ba6d476c277824de824ab38fb053bc9e8b662c7

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

describe Spree::LineItemSerializer do
  let(:line_item) { create :line_item }
  subject { ActiveModel::Serializer::Adapter::JsonApi.new(described_class.new line_item) }

  its(:to_json) do
    is_expected.to be_json_eql <<-JSON
      {
        "data" : {
          "attributes" : {
            "additional_tax_total" : 0,
            "adjustment_total" : 0.0,
            "amount" : "10.0",
            "cost_price" : "17.0",
            "currency" : "USD",
            "display_amount" : "$10.00",
            "display_total" : "$10.00",
            "order_id" : #{line_item.order_id},
            "price" : "10.0",
            "quantity" : 1,
            "total" : "10.0",
            "variant_id" : #{line_item.variant_id}
          },
          "relationships" : {
            "order" : {
              "data" : {
                "type" : "spree_orders"
              }
            },
            "variant" : {
              "data" : {
                "type" : "spree_variants"
              }
            }
          },
          "type" : "spree_line_items"
        }
      }
    JSON
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
spree_api_v2-0.2.2 spec/serializers/spree/line_item_serializer_spec.rb
solidus_api_v2-0.2.2 spec/serializers/spree/line_item_serializer_spec.rb
solidus_api_v2-0.2.1 spec/serializers/spree/line_item_serializer_spec.rb
spree_api_v2-0.2.1 spec/serializers/spree/line_item_serializer_spec.rb
spree_api_v2-0.2.0 spec/serializers/spree/line_item_serializer_spec.rb
solidus_api_v2-0.2.0 spec/serializers/spree/line_item_serializer_spec.rb