Sha256: a6d61f2beecc36263c9397683f3f6c29ca25bf203fde45823a0d51a373dcfbb5

Contents?: true

Size: 1.32 KB

Versions: 11

Compression:

Stored size: 1.32 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe RequestSignature do
  
  describe "initialization" do

    it "should have assigned normalized uri" do
      WebMock::Util::URI.should_receive(:normalize_uri).and_return("www.example.kom")
      signature = RequestSignature.new(:get, "www.example.com")
      signature.uri.should == "www.example.kom"
    end

    it "should have assigned uri without normalization if uri is URI" do
      WebMock::Util::URI.should_not_receive(:normalize_uri)
      uri = Addressable::URI.parse("www.example.com")
      signature = RequestSignature.new(:get, uri)
      signature.uri.should == uri
    end

    it "should have assigned normalized headers" do
      WebMock::Util::Headers.should_receive(:normalize_headers).with('A' => 'a').and_return('B' => 'b')
      RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}).headers.should == {'B' => 'b'}
    end

    it "should have assigned body" do
      RequestSignature.new(:get, "www.example.com", :body => "abc").body.should == "abc"
    end

  end

  it "should report string describing itself" do
    RequestSignature.new(:get, "www.example.com",
      :body => "abc", :headers => {'A' => 'a', 'B' => 'b'}).to_s.should ==
    "GET http://www.example.com/ with body 'abc' with headers {'A'=>'a', 'B'=>'b'}"
  end
  
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
webmock-1.3.5 spec/request_signature_spec.rb
webmock-1.3.4 spec/request_signature_spec.rb
webmock-1.3.3 spec/request_signature_spec.rb
webmock-1.3.2 spec/request_signature_spec.rb
webmock-1.3.1 spec/request_signature_spec.rb
webmock-1.3.0 spec/request_signature_spec.rb
webmock-1.2.2 spec/request_signature_spec.rb
webmock-1.2.1 spec/request_signature_spec.rb
webmock-1.2.0 spec/request_signature_spec.rb
webmock-1.1.0 spec/request_signature_spec.rb
webmock-1.0.0 spec/request_signature_spec.rb