mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 06:34:46 +02:00
Rename Payments to PaymentOrders
This commit is contained in:
parent
a1bbdc0d8e
commit
d92004cbe0
9 changed files with 20 additions and 20 deletions
58
test/models/payment_orders_test.rb
Normal file
58
test/models/payment_orders_test.rb
Normal file
|
@ -0,0 +1,58 @@
|
|||
require 'test_helper'
|
||||
|
||||
class PaymentOrdersTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
super
|
||||
|
||||
@original_methods = ENV['payment_methods']
|
||||
@original_seb_URL = ENV['seb_payment_url']
|
||||
ENV['payment_methods'] = 'seb, swed, credit_card'
|
||||
ENV['seb_payment_url'] = nil
|
||||
@not_implemented_payment = PaymentOrders::Base.new(
|
||||
'not_implemented', Invoice.new
|
||||
)
|
||||
end
|
||||
|
||||
def teardown
|
||||
super
|
||||
|
||||
ENV['payment_methods'] = @original_methods
|
||||
ENV['seb_payment_url'] = @original_seb_URL
|
||||
end
|
||||
|
||||
def test_variable_assignment
|
||||
assert_equal 'not_implemented', @not_implemented_payment.type
|
||||
assert_nil @not_implemented_payment.response_url
|
||||
assert_nil @not_implemented_payment.return_url
|
||||
assert_nil @not_implemented_payment.form_url
|
||||
end
|
||||
|
||||
def test_that_errors_are_raised_on_missing_methods
|
||||
assert_raise NoMethodError do
|
||||
@not_implemented_payment.valid_response?
|
||||
end
|
||||
|
||||
assert_raise NoMethodError do
|
||||
@not_implemented_payment.settled_payment?
|
||||
end
|
||||
|
||||
assert_raise NoMethodError do
|
||||
@not_implemented_payment.form_fields
|
||||
end
|
||||
|
||||
assert_raise NoMethodError do
|
||||
@not_implemented_payment.complete_transaction
|
||||
end
|
||||
end
|
||||
|
||||
def test_that_create_with_type_raises_argument_error
|
||||
assert_raise ArgumentError do
|
||||
PaymentOrders.create_with_type("not_implemented", Invoice.new)
|
||||
end
|
||||
end
|
||||
|
||||
def test_create_with_correct_subclass
|
||||
payment = PaymentOrders.create_with_type('seb', Invoice.new)
|
||||
assert_equal PaymentOrders::BankLink, payment.class
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue