Sha256: 7f215c2228a0b70f0fae42bc5d1d0f1803530cdb702902a7d5352b4829dc87e4

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe RakutenWebService do
  describe '.configure' do
    context 'given block has one arity' do
      before do
        RakutenWebService.configure do |c|
          c.affiliate_id = 'dummy_affiliate_id'
          c.application_id = 'dummy_application_id'
        end
      end

      subject { RakutenWebService.configuration }

      describe '#affiliate_id' do
        subject { super().affiliate_id }
        it { is_expected.to eq('dummy_affiliate_id') }
      end

      describe '#application_id' do
        subject { super().application_id }

        it { is_expected.to eq('dummy_application_id') }
      end
    end

    context 'given block has more or less one arity' do
      specify 'raise ArgumentError' do
        expect do
          RakutenWebService.configure do
          end
        end.to raise_error(ArgumentError)

        expect do
          RakutenWebService.configure do |c, _|
            c.affiliate_id = 'dummy_affiliate_id'
            c.application_id = 'dummy_application_id'
          end
        end.to raise_error(ArgumentError)
      end
    end
    context 'call without block' do
      specify 'raise ArgumentError' do
        expect { RakutenWebService.configure }.to raise_error(ArgumentError)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rakuten_web_service-1.13.2 spec/rakuten_web_service_spec.rb
rakuten_web_service-1.13.1 spec/rakuten_web_service_spec.rb
rakuten_web_service-1.13.0 spec/rakuten_web_service_spec.rb
rakuten_web_service-1.12.0 spec/rakuten_web_service_spec.rb
rakuten_web_service-1.11.0 spec/rakuten_web_service_spec.rb