Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #5 from carlaares/master
Browse files Browse the repository at this point in the history
fixed state validation on report
  • Loading branch information
Ernesto Tagwerker committed Feb 5, 2014
2 parents d7300b4 + 962f7d2 commit 3c8ad9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dinero_mail_ipn/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Report
def initialize(opts)
@id = opts[:id]
@amount = opts[:amount]
@state = opts[:state]
@state = opts[:state].to_i
@payer_email = opts[:payer_email]
@numtransaction = opts[:numtransaction]
@date = opts[:date]
Expand Down
6 changes: 6 additions & 0 deletions test/test_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@ def test_report_amount
def test_transaction_completed?
report = DineroMailIpn::Report.new(:state => 2)
assert report.transaction_completed?
report = DineroMailIpn::Report.new(:state => "2")
assert report.transaction_completed?
end

def test_transaction_pending?
report = DineroMailIpn::Report.new(:state => 1)
assert report.transaction_pending?
report = DineroMailIpn::Report.new(:state => "1")
assert report.transaction_pending?
end

def test_transaction_cancelled?
report = DineroMailIpn::Report.new(:state => 3)
assert report.transaction_cancelled?
report = DineroMailIpn::Report.new(:state => "3")
assert report.transaction_cancelled?
end

end

0 comments on commit 3c8ad9f

Please sign in to comment.