Sha256: d045bd1af5fb246f078b9001d7557588caa251ec8bdd0e1e3b51d5a4ac44ab7a

Contents?: true

Size: 852 Bytes

Versions: 12

Compression:

Stored size: 852 Bytes

Contents

# -*- encoding: utf-8 -*-

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

require 'pmp/configuration'

class TestConnection
  include PMP::Connection
end

describe PMP::Connection do

  before {
    @tc = TestConnection.new
  }

  it "sets default connection options" do
    opts = @tc.process_options
    opts.wont_be_nil
  end

  it "sets default connection options" do
    opts = @tc.process_options(endpoint:'endpoint')
    opts[:ssl].must_equal({:verify => false})
    opts[:url].must_equal 'endpoint'
  end

  it "mereges headers for connection options" do
    opts = @tc.process_options(user_agent:'user_agent', headers:{foo:'bar'})
    opts[:headers][:foo].must_equal 'bar'
    opts[:headers]['User-Agent'].must_equal 'user_agent'
    opts[:headers]['Accept'].must_equal "application/vnd.pmp.collection.doc+json"
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pmp-0.3.2 spec/connection_spec.rb
pmp-0.3.1 spec/connection_spec.rb
pmp-0.3.0 spec/connection_spec.rb
pmp-0.2.4 spec/connection_spec.rb
pmp-0.2.3 spec/connection_spec.rb
pmp-0.2.2 spec/connection_spec.rb
pmp-0.2.1 spec/connection_spec.rb
pmp-0.2.0 spec/connection_spec.rb
pmp-0.1.3 spec/connection_spec.rb
pmp-0.1.2 spec/connection_spec.rb
pmp-0.1.1 spec/connection_spec.rb
pmp-0.1.0 spec/connection_spec.rb