Sha256: 7daf22199d886ae33e6ac6eac334f5ed7eb159ab20cbee2fff43786649fc5352

Contents?: true

Size: 768 Bytes

Versions: 2

Compression:

Stored size: 768 Bytes

Contents

require 'spec_helper'

describe MWS::Request do
  let(:request){ MWS::Request.new(valid_args) }
  let(:valid_args){
    {
      path: "/?Attr=Value",
      endpoint: "mws.amazonservices.com",
      headers: {},
      body: ""
    }
  }

  describe "initialize" do
    subject{ request }
    it{ is_expected.to be_a MWS::Request }
  end

  describe "#execute" do
    context "POST" do
      before do
        http = Net::HTTP.new("")
        expect(http).to receive(:use_ssl=).with(true)
        expect(http).to receive(:start).and_yield(http)
        expect(http).to receive(:post)
        expect(Net::HTTP).to receive(:new).and_return(http)
      end

      it "should POST request" do
        expect{ request.execute }.not_to raise_error
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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