Sha256: 9538ac4f56b6d247168155b952741f61d093f9a550c0b8ee26ea2baff9df013a
Contents?: true
Size: 1.93 KB
Versions: 2
Compression:
Stored size: 1.93 KB
Contents
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper") describe Cardflex::Configuration do it 'only sets environment, logger, api_key, and/or endpoint' do sut = Cardflex::Configuration.new({ :environment => 'test', :logger => 'test', :api_key => '123', :endpoint => 'test' }) expect(sut.api_key).to eq '123' end it 'should require api_key' do expect { Cardflex::Configuration.new }.not_to raise_error end it 'should set environment' do Cardflex::Configuration.environment = :test expect(Cardflex::Configuration.environment).to eq :test end it 'should throw an ArgumentError if environment is set wrong' do expect { Cardflex::Configuration.environment = :invalid }.to raise_error ArgumentError end it 'should use https' do sut = Cardflex::Configuration.new({ :environment => :test }) expect(sut.protocol).to eq "https" expect(sut.ssl?).to be true end it 'should get the certificate file path' do sut = Cardflex::Configuration.new expect(sut.ca_file).to match "ca-certificates.ca.crt" end it 'should get the 3 step url' do sut = Cardflex::Configuration.new({ :environment => :test }) expect(sut.three_step_path).to match "/api/v2/three-step" end it 'should get the query url' do sut = Cardflex::Configuration.new({ :environment => :test }) expect(sut.query_path).to match "/api/query.php" end it 'should get the api version' do sut = Cardflex::Configuration.new expect(sut.api_version).to eq 2 end it 'should get the correct port' do sut = Cardflex::Configuration.new({ :environment => :test }) expect(sut.port).to eq 443 end it 'should get a logger set to INFO level' do sut = Cardflex::Configuration.new expect(sut.logger.level).to be Logger::INFO end it 'should create a new Http instance out of this config' do sut = Cardflex::Configuration.new expect(sut.http.config).to be sut end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cardflex-ruby-0.1.2 | spec/unit/cardflex/configuration_spec.rb |
cardflex-ruby-0.1.1 | spec/unit/cardflex/configuration_spec.rb |