Sha256: cf75e4d4a356cba7f50ad4adc4f186342fe00e613f4d0ee4676b460edba58f29
Contents?: true
Size: 1.31 KB
Versions: 25
Compression:
Stored size: 1.31 KB
Contents
require 'spec_helper' # # Attributes describe Effective::Providers::StripeCharge do let(:order) { FactoryGirl.create(:order_with_subscription) } let(:charge) { Effective::Providers::StripeCharge.new(order) } before { StripeMock.start } after { StripeMock.stop } it 'can be initialized with an order' do charge = Effective::Providers::StripeCharge.new(order) charge.order.should eq order charge.effective_order_id.should eq order.to_param end it 'can be initialized without an order' do charge = Effective::Providers::StripeCharge.new(:token => 'tok_123', :effective_order_id => 3) charge.token.should eq 'tok_123' charge.effective_order_id.should eq 3 charge.order.nil?.should eq true end it 'performs validations' do charge = Effective::Providers::StripeCharge.new() charge.valid?.should eq false charge.errors[:token].present?.should eq true charge.errors[:effective_order_id].present?.should eq true end it '#order_items returns all OrderItems where the purchasable is not a Subscription' do charge.order_items.all? { |oi| oi.purchasable_type != 'Effective::Subscription'}.should eq true end it '#subscriptions returns all Subscriptions (not order items)' do charge.subscriptions.all? { |oi| oi.kind_of?(Effective::Subscription) }.should eq true end end
Version data entries
25 entries across 25 versions & 1 rubygems