Sha256: 68c520db1d5fa092f4b220d03a1aa812a63bf2828dfbf45899c559b1ed9a20b0

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

describe SWD do
  after { SWD.debugging = false }

  its(:logger) { should be_a Logger }
  its(:debugging?) { should be_false }
  its(:cache) { should be_a SWD::Cache }

  describe '#discover!' do
    it 'should return SWD::Response' do
      mock_json "https://example.com/.well-known/simple-web-discovery", 'success', :query => {
        :principal => 'mailto:joe@example.com',
        :service => 'urn:adatum.com:calendar'
      } do
        SWD.discover!(
          :principal => 'mailto:joe@example.com',
          :service => 'urn:adatum.com:calendar',
          :host => 'example.com'
        ).should be_a SWD::Response
      end
    end
  end

  describe '.debug!' do
    before { SWD.debug! }
    its(:debugging?) { should be_true }
  end

  describe '.debug' do
    it 'should enable debugging within given block' do
      SWD.debug do
        SWD.debugging?.should be_true
      end
      SWD.debugging?.should be_false
    end

    it 'should not force disable debugging' do
      SWD.debug!
      SWD.debug do
        SWD.debugging?.should be_true
      end
      SWD.debugging?.should be_true
    end
  end

  describe '.http_client' do
    context 'with http_config' do
      before do
        SWD.http_config do |config|
          config.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
        end
      end
      it 'should configure http_client' do
        SWD.http_client.ssl_config.verify_mode.should == OpenSSL::SSL::VERIFY_NONE
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
swd-0.1.2 spec/swd_spec.rb
swd-0.1.1 spec/swd_spec.rb
swd-0.1.0 spec/swd_spec.rb
swd-0.0.9 spec/swd_spec.rb
swd-0.0.8 spec/swd_spec.rb