Sha256: cf91c221df1a279002ede09243cbae7dcd375c855ce5b4a36746ea824087915d

Contents?: true

Size: 968 Bytes

Versions: 6

Compression:

Stored size: 968 Bytes

Contents

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

describe WebMock::Util::Headers do

  it "should decode_userinfo_from_header handles basic auth" do
    authorization_header = "Basic dXNlcm5hbWU6c2VjcmV0"
    userinfo = WebMock::Util::Headers.decode_userinfo_from_header(authorization_header)
    userinfo.should == "username:secret"
  end

  describe "sorted_headers_string" do

    it "should return nice string for hash with string values" do
      WebMock::Util::Headers.sorted_headers_string({"a" => "b"}).should == "{'A'=>'b'}"
    end

    it "should return nice string for hash with array values" do
      WebMock::Util::Headers.sorted_headers_string({"a" => ["b", "c"]}).should == "{'A'=>['b', 'c']}"
    end

    it "should return nice string for hash with array values and string values" do
      WebMock::Util::Headers.sorted_headers_string({"a" => ["b", "c"], "d" => "e"}).should == "{'A'=>['b', 'c'], 'D'=>'e'}"
    end


  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
webmock-1.7.5 spec/util/headers_spec.rb
webmock-1.7.4 spec/util/headers_spec.rb
webmock-1.7.3 spec/util/headers_spec.rb
webmock-1.7.2 spec/util/headers_spec.rb
webmock-1.7.1 spec/util/headers_spec.rb
webmock-1.7.0 spec/util/headers_spec.rb