Skip to content

Commit 1ec5cd5

Browse files
committed
SecurePayAU: Refactor test billing details
Moved them out of the way into the config section test/remote/gateways/remote_secure_pay_au_test.rb 18 tests, 57 assertions, 0 failures, 0 errors, 0 pendings, 2 omissions, 0 notifications 100% passed
1 parent ff7d771 commit 1ec5cd5

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

test/remote/gateways/remote_secure_pay_au_test.rb

+17-12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ def setup
2525
billing_address: address,
2626
description: 'Store Purchase'
2727
}
28+
29+
@billing_options = {
30+
billing_id: 'billing1234',
31+
amount: 15000
32+
}
2833
end
2934

3035
def test_successful_purchase
@@ -126,44 +131,44 @@ def test_failed_void
126131
end
127132

128133
def test_successful_unstore
129-
@gateway.store(@credit_card, {billing_id: 'test1234', amount: 15000}) rescue nil
134+
@gateway.store(@credit_card, @billing_options) rescue nil
130135

131-
assert response = @gateway.unstore('test1234')
136+
assert response = @gateway.unstore('billing1234')
132137
assert_success response
133138

134139
assert_equal 'Successful', response.message
135140
end
136141

137142
def test_repeat_unstore
138-
@gateway.unstore('test1234') rescue nil # Ensure it is already missing
143+
@gateway.unstore('billing1234') rescue nil # Ensure it is already missing
139144

140-
response = @gateway.unstore('test1234')
145+
response = @gateway.unstore('billing1234')
141146

142147
assert_success response
143148
end
144149

145150
def test_successful_store
146-
@gateway.unstore('test1234') rescue nil
151+
@gateway.unstore('billing1234') rescue nil
147152

148-
assert response = @gateway.store(@credit_card, {billing_id: 'test1234', amount: 15000})
153+
assert response = @gateway.store(@credit_card, @billing_options)
149154
assert_success response
150155

151156
assert_equal 'Successful', response.message
152157
end
153158

154159
def test_failed_store
155-
@gateway.store(@credit_card, {billing_id: 'test1234', amount: 15000}) rescue nil # Ensure it already exists
160+
@gateway.store(@credit_card, @billing_options) rescue nil # Ensure it already exists
156161

157-
assert response = @gateway.store(@credit_card, {billing_id: 'test1234', amount: 15000})
162+
assert response = @gateway.store(@credit_card, @billing_options)
158163
assert_failure response
159164

160165
assert_equal 'Duplicate Client ID Found', response.message
161166
end
162167

163168
def test_successful_triggered_payment
164-
@gateway.store(@credit_card, {billing_id: 'test1234', amount: 15000}) rescue nil # Ensure it already exists
169+
@gateway.store(@credit_card, @billing_options) rescue nil # Ensure it already exists
165170

166-
assert response = @gateway.purchase(12300, 'test1234', @options)
171+
assert response = @gateway.purchase(12300, 'billing1234', @options)
167172
assert_success response
168173
assert_equal response.params['amount'], '12300'
169174
assert_equal response.params['ponum'], 'order123'
@@ -172,9 +177,9 @@ def test_successful_triggered_payment
172177
end
173178

174179
def test_failure_triggered_payment
175-
@gateway.unstore('test1234') rescue nil # Ensure its no longer there
180+
@gateway.unstore('billing1234') rescue nil # Ensure its no longer there
176181

177-
assert response = @gateway.purchase(12300, 'test1234', @options)
182+
assert response = @gateway.purchase(12300, 'billing1234', @options)
178183
assert_failure response
179184

180185
assert_equal 'Payment not found', response.message

0 commit comments

Comments
 (0)