mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
Rename #create_with_type to #new_with_type
This commit is contained in:
parent
fe8d1d1f0b
commit
5d8e78f3c6
4 changed files with 16 additions and 14 deletions
|
@ -44,34 +44,34 @@ class PaymentOrdersTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_correct_channel_is_assigned
|
||||
everypay_channel = PaymentOrder.create_with_type(type: 'every_pay', invoice: @invoice)
|
||||
everypay_channel = PaymentOrder.new_with_type(type: 'every_pay', invoice: @invoice)
|
||||
assert_equal everypay_channel.channel, 'EveryPay'
|
||||
assert_equal everypay_channel.class.config_namespace_name, 'every_pay'
|
||||
|
||||
swed_channel = PaymentOrder.create_with_type(type: 'swed', invoice: @invoice)
|
||||
swed_channel = PaymentOrder.new_with_type(type: 'swed', invoice: @invoice)
|
||||
assert_equal swed_channel.channel, 'Swed'
|
||||
assert_equal swed_channel.class.config_namespace_name, 'swed'
|
||||
|
||||
seb_channel = PaymentOrder.create_with_type(type: 'seb', invoice: @invoice)
|
||||
seb_channel = PaymentOrder.new_with_type(type: 'seb', invoice: @invoice)
|
||||
assert_equal seb_channel.channel, 'Seb'
|
||||
assert_equal seb_channel.class.config_namespace_name, 'seb'
|
||||
|
||||
lhv_channel = PaymentOrder.create_with_type(type: 'lhv', invoice: @invoice)
|
||||
lhv_channel = PaymentOrder.new_with_type(type: 'lhv', invoice: @invoice)
|
||||
assert_equal lhv_channel.channel, 'Lhv'
|
||||
assert_equal lhv_channel.class.config_namespace_name, 'lhv'
|
||||
|
||||
admin_channel = PaymentOrder.create_with_type(type: 'admin_payment', invoice: @invoice)
|
||||
admin_channel = PaymentOrder.new_with_type(type: 'admin_payment', invoice: @invoice)
|
||||
assert_equal admin_channel.channel, 'AdminPayment'
|
||||
assert_equal admin_channel.class.config_namespace_name, 'admin_payment'
|
||||
|
||||
system_channel = PaymentOrder.create_with_type(type: 'system_payment', invoice: @invoice)
|
||||
system_channel = PaymentOrder.new_with_type(type: 'system_payment', invoice: @invoice)
|
||||
assert_equal system_channel.channel, 'SystemPayment'
|
||||
assert_equal system_channel.class.config_namespace_name, 'system_payment'
|
||||
end
|
||||
|
||||
def test_can_not_create_order_for_paid_invoice
|
||||
invoice = invoices(:one)
|
||||
payment_order = PaymentOrder.create_with_type(type: 'every_pay', invoice: invoice)
|
||||
payment_order = PaymentOrder.new_with_type(type: 'every_pay', invoice: invoice)
|
||||
assert payment_order.invalid?
|
||||
assert_includes payment_order.errors[:invoice], 'is already paid'
|
||||
end
|
||||
|
@ -84,7 +84,7 @@ class PaymentOrdersTest < ActiveSupport::TestCase
|
|||
|
||||
def test_can_not_create_order_with_invalid_type
|
||||
assert_raise NameError do
|
||||
PaymentOrder.create_with_type(type: 'not_implemented', invoice: Invoice.new)
|
||||
PaymentOrder.new_with_type(type: 'not_implemented', invoice: Invoice.new)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -97,7 +97,7 @@ class PaymentOrdersTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_can_create_with_correct_subclass
|
||||
payment = PaymentOrder.create_with_type(type: 'seb', invoice: Invoice.new)
|
||||
payment = PaymentOrder.new_with_type(type: 'seb', invoice: Invoice.new)
|
||||
assert_equal PaymentOrders::Seb, payment.class
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue