Sha256: 75ffefb5a9871575cfc006318018c454b38a0e9540efdc95c9e4b02d9b8b91cc
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
require 'spec_helper' describe Spike::Charge do let(:secret_api_key) { 'sk_test_Lkg0iMrN5x02S7e4WVE5FgTj' } describe 'create new charge' do let(:token) { 'tok_rNUiMLP32pYQkpe2PqYAUuHK' } let(:products) { [{title: '商品', description: '商品説明', language: 'JA', price: 900, currency: 'JPY', count: 1, id: '00001', stock: 10}]} let(:request_params) { { amount: 900, currency: 'JPY', card: token } } subject do res = nil VCR.use_cassette 'lib/spike_create_charge' do res = Spike.new(secret_api_key).charge.create(request_params, products) end res end it { expect(subject.object).to eq 'charge' } it { expect(subject).to_not be_live_mode } it { expect(subject).to be_paid } it { expect(subject).to be_captured } it { expect(subject.amount).to eq 900.0 } it { expect(subject.currency).to eq 'JPY' } it { expect(subject).to_not be_refunded } it { expect(subject.amount_refunded).to be_nil } it { expect(subject.refunds).to be_empty } end describe 'get charge' do subject do res = nil VCR.use_cassette 'lib/spike_get_charge' do res = Spike.new(secret_api_key).charge.retrieve("20141007-113905-mj7atv4rkg") end end it { expect(subject.object).to eq 'charge' } it { expect(subject).to_not be_live_mode } it { expect(subject).to be_paid } it { expect(subject).to be_captured } it { expect(subject.amount).to eq 900.0 } it { expect(subject.currency).to eq 'JPY' } it { expect(subject).to_not be_refunded } it { expect(subject.amount_refunded).to be_nil } it { expect(subject.refunds).to be_empty } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spike-ruby-0.0.3 | spec/spike_spec.rb |