test/test_helper.rb in stripe-1.8.3 vs test/test_helper.rb in stripe-1.8.4

- old
+ new

@@ -1,13 +1,13 @@ require 'stringio' require 'test/unit' require 'stripe' -require 'mocha' +require 'mocha/setup' include Mocha #monkeypatch request methods -module Stripe +module Stripe @mock_rest_client = nil def self.mock_rest_client=(mock_client) @mock_rest_client = mock_client end @@ -40,20 +40,13 @@ :bills => [], :charges => [], :livemode => false, :object => "customer", :id => "c_test_customer", - :active_card => { - :type => "Visa", - :last4 => "4242", - :exp_month => 11, - :country => "US", - :exp_year => 2012, - :id => "cc_test_card", - :object => "card" - }, - :created => 1304114758 + :default_card => "cc_test_card", + :created => 1304114758, + :cards => test_card_array('c_test_customer') }.merge(params) end def test_customer_array { @@ -86,34 +79,43 @@ }.merge(params) end def test_charge_array { - :data => [test_charge, test_charge, test_charge], + :data => [test_charge, test_charge, test_charge], :object => 'list', :url => '/v1/charges' } end +def test_card_array(customer_id) + { + :data => [test_card, test_card, test_card], + :object => 'list', + :url => '/v1/customers/' + customer_id + '/cards' + } +end + def test_card(params={}) { :type => "Visa", :last4 => "4242", :exp_month => 11, :country => "US", :exp_year => 2012, :id => "cc_test_card", - :object => "card" + :customer => 'c_test_customer', + :object => "card" }.merge(params) end def test_coupon(params={}) { :duration => 'repeating', :duration_in_months => 3, :percent_off => 25, :id => "co_test_coupon", - :object => "coupon" + :object => "coupon" }.merge(params) end #FIXME nested overrides would be better than hardcoding plan_id def test_subscription(plan_id="gold")