Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support custom subscription IDs.

  • Loading branch information...
commit a03ed653415534238edf4fca70f43cdb0f583719 1 parent 6c8f1bb
@tysontate tysontate authored gabebw committed
View
3  lib/fake_braintree/subscription.rb
@@ -3,9 +3,10 @@ class Subscription
include Helpers
def initialize(subscription_hash_from_params, options)
+ id = subscription_hash_from_params['id'] || options[:id]
@subscription_hash = subscription_hash_from_params.merge(
'merchant_id' => options[:merchant_id],
- 'id' => options[:id]
+ 'id' => id
)
set_subscription_id
set_subscription_status
View
4 spec/fake_braintree/subscription_spec.rb
@@ -15,6 +15,10 @@
create_subscription.subscription.id.should =~ /^[a-z0-9]{6}$/
end
+ it 'supports custom IDs' do
+ create_subscription('id' => 'custom1').subscription.id.should == 'custom1'
+ end
+
it 'assigns unique IDs to each subscription' do
cc_token_1 = cc_token
cc_token_2 = braintree_credit_card_token(TEST_CC_NUMBER.sub('1', '5'), expiration_date)
Please sign in to comment.
Something went wrong with that request. Please try again.