Sha256: e7a55d2cc2928e873741e26463a45dd9c50eb8c245faec176b86df3001862a15

Contents?: true

Size: 1018 Bytes

Versions: 2

Compression:

Stored size: 1018 Bytes

Contents

require 'spec_helper'

describe MWS::QueryString do
  let(:query_string){ MWS::QueryString.new(valid_args) }
  let(:valid_args){
    {
      key: "ThisIsSigningKey",
      endpoint: "mws.amazonservices.com",
      params: {
        "Action" => "SubmitFeed",
        "Timestamp" => Time.new(2009, 8, 20, 1, 10, 27, 607),
        "SomethingIdList" => [123, 456],
        "SomethingTypeList" => ["ABC", "DEF"]
      }
    }
  }

  describe "initialize" do
    subject{ query_string }
    it{ is_expected.to be_a String }
    it("should be formated with query style"){ is_expected.to match /\A([^=&]+=[^=&]+)(&[^=&]+=[^=&]+)*\Z/ }
    it("should be URI encoded"){ is_expected.not_to match /\A[A-Za-z0-9\-\_\.\~]*\Z/ }
    it("should have timestamp in ISO8601 format"){ is_expected.to match /\d{4}-\d{2}-\d{2}T\d{2}%3A\d{2}%3A\d{2}/ }
    it("should have expanded ids"){ is_expected.to match "SomethingIdList.Id.1=123" }
    it("should have expanded types"){ is_expected.to match "SomethingTypeList.Type.2=DEF" }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
marketplace_web_service-0.0.4 spec/mws/query_string_spec.rb
marketplace_web_service-0.0.3 spec/mws/query_string_spec.rb