Skip to content
Browse files

Don't try to check the next billing date without a subscription

  • Loading branch information...
1 parent b5332b2 commit da25cbc9411218f9ace11d24db1c835791333451 @jferris jferris committed
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/ashmont/subscription.rb
  2. +4 −0 spec/ashmont/subscription_spec.rb
View
2 lib/ashmont/subscription.rb
@@ -44,7 +44,7 @@ def most_recent_transaction
end
def next_billing_date
- merchant_account_time_zone.parse(remote_subscription.next_billing_date)
+ merchant_account_time_zone.parse(remote_subscription.next_billing_date) if remote_subscription
end
def reload
View
4 spec/ashmont/subscription_spec.rb
@@ -20,6 +20,10 @@
result.strftime("%Y-%m-%d").should == unconverted_date
end
+ it "doesn't have a next billing date without a remote subscription" do
+ Ashmont::Subscription.new.next_billing_date.should be_nil
+ end
+
it "returns the token" do
subscription = Ashmont::Subscription.new('abc')
subscription.token.should == 'abc'

0 comments on commit da25cbc

Please sign in to comment.
Something went wrong with that request. Please try again.