Sha256: 602f1ff927789f6a7f625f704b45f45ce0c39c3b2260940164bb54b9498ea402

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require "spec_helper"

module ShipCompliant
  describe Configuration do

    before do
      ShipCompliant.configuration = nil
      ShipCompliant.configure do |c|
        c.partner_key = 'abc-123'
        c.username = 'bob@example.com'
        c.password = 'secret'
      end
    end
    
    it "stores user credentials" do
      expect(ShipCompliant.configuration.partner_key).to eq('abc-123')
      expect(ShipCompliant.configuration.username).to eq('bob@example.com')
      expect(ShipCompliant.configuration.password).to eq('secret')
    end

    it "creates authentication hash" do
      expect(ShipCompliant.configuration.credentials).to eq({
        'PartnerKey' => 'abc-123',
        'Username' => 'bob@example.com',
        'Password' => 'secret'
      })
    end

    it "defaults log to true" do
      expect(ShipCompliant.configuration.log).to be_truthy
    end

    context "wsdl" do
      it "defaults to core services" do
        expect(ShipCompliant.configuration.wsdl).to eq('https://ws-dev.shipcompliant.com/services/1.2/coreservice.asmx?WSDL')
      end

      it "can be changed" do
        ShipCompliant.configure do |c|
          c.wsdl = 'http://example.com'
        end
        expect(ShipCompliant.configuration.wsdl).to eq('http://example.com')
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ship_compliant-0.2.1 spec/lib/ship_compliant/configuration_spec.rb