Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion models/payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def self.sorted(year=2007,limit=20)
limit(limit).
all
end

def date
self.year.year
end
Expand Down
18 changes: 12 additions & 6 deletions spec/payment_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
require 'spec_helper'

describe "test the payment methods" do
# before(:each) do
# @payment = Payment.new(:year_id => "1")
# end

# it "get the date for the payment" do
# expect(Payment.where(year_id(1)).first.date).to eq(2004)
# end
it "get the date for the payment" do
expect(Payment.find(:year_id => 7 ).date).to eq(2010)
end

it "get the amount of payment" do
expect(Payment.number).to eq(9)
end

it "get sorted payment of a year" do
expect(Payment.sorted(2010, 5).count).to eq(5)
expect(Payment.sorted(2010, 5).first.year_id).to eq(7)
expect(Payment.sorted(2010, 5)[0].amount_euro).to be > Payment.sorted(2010, 5)[1].amount_euro
end
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def self.populate_payment_table
year_id: year_id,
recipient_id: recipient_id
)
p "#{row['amountEuro']}"
end
end
i += 1
Expand All @@ -97,3 +96,4 @@ def self.populate_payment_table

require "models/year"
require "models/recipient"
require "models/payment"