-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add specs around the payment callback
- Loading branch information
Mohnish Thallavajhula
committed
Mar 5, 2015
1 parent
fe3e2b6
commit 59e7f85
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,27 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Payment do | ||
describe '#update_bill_attributes' do | ||
context 'when the bill is non-recurring' do | ||
let(:payment) do | ||
payment = create(:payment) | ||
payment.bill.update(repeat_interval: create(:repeat_interval, interval: 'one_time')) | ||
payment | ||
end | ||
|
||
it 'marks the bill as inactive' do | ||
payment.update_bill_attributes | ||
expect(payment.bill.inactive?).to be_truthy | ||
end | ||
end | ||
|
||
context 'when the bill is recurring' do | ||
let(:payment) { create(:payment) } | ||
|
||
it 'updates the bills due date' do | ||
payment.update_bill_attributes | ||
expect(payment.bill.next_due_date.strftime('%m/%d/%Y')).to eql(2.months.since.strftime('%m/%d/%Y')) | ||
end | ||
end | ||
end | ||
end |