Implement code review changes

This commit is contained in:
Maciej Szlosarczyk 2018-04-23 15:23:36 +03:00
parent b56fd73c92
commit e1149bf92b
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
3 changed files with 6 additions and 23 deletions

View file

@ -26,24 +26,8 @@ module Payments
transaction.save!
end
def complete_transaction
raise NotImplementedError
end
def settled_payment?
raise NotImplementedError
end
def form_fields
raise NotImplementedError
end
def form_url
ENV["payments_#{type}_url"]
end
def valid_response?
raise NotImplementedError
end
end
end

View file

@ -38,8 +38,7 @@ class EveryPayTest < ActiveSupport::TestCase
@every_pay = Payments::EveryPay.new('every_pay', @invoice, params)
@other_pay = Payments::EveryPay.new('every_pay', @invoice, {})
# To avoid problems with time conversion.
travel_to Time.at(1522542600)
travel_to Time.zone.parse('2018-04-01 00:30:00 +0000')
end
def teardown

View file

@ -27,20 +27,20 @@ class PaymentTest < ActiveSupport::TestCase
assert_nil @not_implemented_payment.form_url
end
def test_that_errors_are_raised_on_not_implemented_methods
assert_raise NotImplementedError do
def test_that_errors_are_raised_on_missing_methods
assert_raise NoMethodError do
@not_implemented_payment.valid_response?
end
assert_raise NotImplementedError do
assert_raise NoMethodError do
@not_implemented_payment.settled_payment?
end
assert_raise NotImplementedError do
assert_raise NoMethodError do
@not_implemented_payment.form_fields
end
assert_raise NotImplementedError do
assert_raise NoMethodError do
@not_implemented_payment.complete_transaction
end
end