Permalink
Browse files

Format subscription.next_billing_date appropriately.

  • Loading branch information...
1 parent 1811656 commit 0dd647170f600d5632bd17047353d2798cf71952 @gabebw gabebw committed Nov 18, 2011
Showing with 9 additions and 3 deletions.
  1. +7 −1 lib/fake_braintree/subscription.rb
  2. +2 −2 spec/fake_braintree/subscription_spec.rb
@@ -13,11 +13,17 @@ def response_hash
response_hash["add_ons"] = []
response_hash["discounts"] = []
response_hash["plan_id"] = @subscription_hash["plan_id"]
- response_hash["next_billing_date"] = 1.month.from_now
+ response_hash["next_billing_date"] = braintree_formatted_date(1.month.from_now)
response_hash["payment_method_token"] = @subscription_hash["payment_method_token"]
response_hash["status"] = Braintree::Subscription::Status::Active
response_hash
end
+
+ private
+
+ def braintree_formatted_date(date)
+ date.strftime('%Y-%m-%d')
+ end
end
end
@@ -24,12 +24,12 @@
first_result.subscription.id.should_not == second_result.subscription.id
end
- it "sets the next billing date to 1 month from now in UTC" do
+ it "sets the next billing date to a string of 1.month.from_now in UTC" do
Timecop.freeze do
result = Braintree::Subscription.create(:payment_method_token => cc_token,
:plan_id => plan_id)
- result.subscription.next_billing_date.to_i.should == 1.month.from_now.utc.to_i
+ result.subscription.next_billing_date.should == 1.month.from_now.utc.strftime('%Y-%m-%d')
end
end

0 comments on commit 0dd6471

Please sign in to comment.