Sha256: ac04a05005f7895b75ad524f242ea0d9ad421258e9733b9627c71f5969baf19b

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe MWS::API::Feeds::Envelope do
  it "should validate the envelope" do
    expect {
      MWS::API::Feeds::Envelope.new(message_type: "InvalidMessageType", message:{"InvalidItem" => "Invalid"})
    }.to raise_error
  end

  it "should skip validation when param skip_schema_validation is true" do
    expect {
      MWS::API::Feeds::Envelope.new(message_type: "InvalidMessageType", message:{"InvalidItem" => "Invalid"}, skip_schema_validation: true)
    }.to_not raise_error
  end

  it "should remove array items" do
    envelope = MWS::API::Feeds::Envelope.new(
                message_type: "InvalidMessageType", 
                message:{
                  "Items" => [{item_1: "1"}, {item_2: "2"}],
                  "Inventories" => [{inventory_1: "1"}]
                },
                skip_schema_validation: true)

    envelope.to_s.include?("Items").should == false
    envelope.to_s.include?("Inventories").should == false
    envelope.to_s.include?("array").should == false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mws-rb-0.0.1 spec/mws-rb/api/feeds/envelope_spec.rb