Sha256: eeacd564329337b15049cbb73611e4f23cfb479fc46804a6d41aafc9243c3491

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

RSpec.describe PerfectMoneyMerchant::SCI do
	let(:sci) do
		PerfectMoneyMerchant::SCI.new(
				payee: 'U1234567',
				price: 10.0,
				currency: 'usd',
				additional: {
						merchandise_name: 'oak field'
				},
				purpose: 'merchandise',
				verification: [:merchandise_name]
		)
	end

	context '#set_field' do
		before(:example) do
			sci.set_field(:some_new_field, 'some_value')
		end

		it 'should dynamically create attribute' do
			expect(sci).to respond_to(:some_new_field)
		end

		it 'created attribute should has value' do
			expect(sci.some_new_field).to eql('some_value')
		end
	end

	describe '#initialize' do
		it 'should has correct payment_amount' do
			expect(sci.payment_amount).to eql(10.0)
		end

		it 'should has verification attributes' do
			expect(sci.verification_code.class).to eql(String)
			expect(sci.verification_fields.class).to eql(String)
		end

		it 'should has additional fields' do
			expect(sci.merchandise_name).to eql('oak field')
		end

		it 'expected baggage fields contain additional fields' do
			expect(sci.baggage_fields.split(' ')).to include('merchandise_name')
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
perfect_money_merchant-0.1.2 spec/perfect_money_merchant/sci_spec.rb
perfect_money_merchant-0.1.1.alpha.1 spec/perfect_money_merchant/sci_spec.rb
perfect_money_merchant-0.1.0.alpha.4 spec/perfect_money_merchant/sci_spec.rb
perfect_money_merchant-0.1.0.alpha.3 spec/perfect_money_merchant/sci_spec.rb