Sha256: 085eff99cd2dafba881bd180b3ad286a593ba37f88d8e0c383701a52ad09923f

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe Configuration do
  context 'with default configuration' do
    describe 'settings' do
      subject { Configuration.instance.settings(nil) }

      its(:host) { should eq 'sandbox' }
      its(:key) { should eq 'MerchantRutravel' }
      its(:password) { should eq '123' }

      it 'should build api' do
        allow(Api.any_instance).to receive(:new).with('sandbox', 'MerchantRutravel', '123')
        Configuration.instance.api_for(nil)
      end
    end
  end

  context 'set up' do
    context 'host' do
      before do
        Configuration.setup :settings do |config|
          config.host = 'host'
          config.key = 'key'
          config.password = 'password'
        end
      end

      subject { Configuration.instance.settings(:settings) }

      its(:host) { should eq 'host' }
      its(:key) { should eq 'key' }
      its(:password) { should eq 'password' }


      it 'should build api' do
        allow(Api.any_instance).to receive(:new).with('host', 'key', 'password')
        Configuration.instance.api_for(nil)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paytureman-1.0.0 spec/requests/service/configuration_spec.rb
paytureman-0.7.0 spec/requests/service/configuration_spec.rb