Sha256: 9d1136408fcf1f89d72e0aa30086161a4b67a7691dc3e87aa53ea4c0770ad9a9

Contents?: true

Size: 974 Bytes

Versions: 8

Compression:

Stored size: 974 Bytes

Contents

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

  its(:to_json) do
    is_expected.to be_json_eql <<-JSON
      {
        "data" : {
          "attributes" : {
            "address1" : "#{address.address1}",
            "address2" : "#{address.address2}",
            "city" : "#{address.city}",
            "first_name" : "#{address.first_name}",
            "last_name" : "#{address.last_name}",
            "phone" : "#{address.phone}",
            "zipcode" : "#{address.zipcode}"
          },
          "relationships" : {
            "country" : {
              "data" : {
                "type" : "spree_countries"
              }
            },
            "state" : {
              "data" : {
                "type" : "spree_states"
              }
            }
          },
          "type" : "spree_addresses"
        }
      }
    JSON
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

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