Sha256: 2c648ce8194d173d365704f0cef2c001fef38b8bd6a77216d68ee185b1025b35

Contents?: true

Size: 921 Bytes

Versions: 52

Compression:

Stored size: 921 Bytes

Contents

require '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

52 entries across 52 versions & 4 rubygems

Version Path
webmock-1.14.0 spec/unit/util/headers_spec.rb
webmock-1.13.0 spec/unit/util/headers_spec.rb
webmock-1.12.3 spec/unit/util/headers_spec.rb
webmock-1.12.2 spec/unit/util/headers_spec.rb
webmock-1.12.1 spec/unit/util/headers_spec.rb
webmock-1.12.0 spec/unit/util/headers_spec.rb
webmock-1.11.0 spec/unit/util/headers_spec.rb
webmock-1.10.2 spec/unit/util/headers_spec.rb
webmock-1.10.1 spec/unit/util/headers_spec.rb
webmock-1.10.0 spec/unit/util/headers_spec.rb
webmock-1.9.3 spec/unit/util/headers_spec.rb
webmock-1.9.2 spec/unit/util/headers_spec.rb
webmock-1.9.1 spec/unit/util/headers_spec.rb
simple-client-0.0.3 vendor/bundle/ruby/1.9.1/gems/webmock-1.8.8/spec/unit/util/headers_spec.rb
webmock-1.9.0 spec/unit/util/headers_spec.rb
webmock-1.8.11 spec/unit/util/headers_spec.rb
webmock-1.8.10 spec/unit/util/headers_spec.rb
webmock-1.8.9 spec/unit/util/headers_spec.rb
simple-client-0.0.2 vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/headers_spec.rb
webmock-1.8.8 spec/unit/util/headers_spec.rb