Sha256: 8a0ecdbf874fad948641878962f58206986022c4d4d135aa779bf52b7ae4cd84

Contents?: true

Size: 984 Bytes

Versions: 7

Compression:

Stored size: 984 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

7 entries across 7 versions & 2 rubygems

Version Path
vanity-1.7.1 vendor/ruby/1.9.1/gems/webmock-1.6.4/spec/util/headers_spec.rb
webmock-1.6.4 spec/util/headers_spec.rb
webmock-1.6.2 spec/util/headers_spec.rb
webmock-1.6.1 spec/util/headers_spec.rb
webmock-1.6.0 spec/util/headers_spec.rb
webmock-1.5.0 spec/util/headers_spec.rb
webmock-1.4.0 spec/util/headers_spec.rb