solidus_paypal_braintree 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +4 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +70 -1
  5. data/Gemfile +2 -5
  6. data/app/models/solidus_paypal_braintree/gateway.rb +2 -0
  7. data/app/models/solidus_paypal_braintree/transaction.rb +2 -2
  8. data/app/models/solidus_paypal_braintree/transaction_import.rb +2 -2
  9. data/lib/solidus_paypal_braintree/engine.rb +5 -3
  10. data/lib/solidus_paypal_braintree/version.rb +1 -1
  11. data/solidus_paypal_braintree.gemspec +0 -1
  12. metadata +7 -125
  13. data/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb +0 -99
  14. data/spec/controllers/solidus_paypal_braintree/client_tokens_controller_spec.rb +0 -55
  15. data/spec/controllers/solidus_paypal_braintree/configurations_controller_spec.rb +0 -73
  16. data/spec/controllers/solidus_paypal_braintree/transactions_controller_spec.rb +0 -183
  17. data/spec/features/backend/configuration_spec.rb +0 -23
  18. data/spec/features/backend/new_payment_spec.rb +0 -137
  19. data/spec/features/frontend/braintree_credit_card_checkout_spec.rb +0 -191
  20. data/spec/features/frontend/paypal_checkout_spec.rb +0 -166
  21. data/spec/features/frontend/venmo_checkout_spec.rb +0 -189
  22. data/spec/fixtures/cassettes/admin/invalid_credit_card.yml +0 -63
  23. data/spec/fixtures/cassettes/admin/resubmit_credit_card.yml +0 -352
  24. data/spec/fixtures/cassettes/admin/valid_credit_card.yml +0 -412
  25. data/spec/fixtures/cassettes/braintree/create_profile.yml +0 -71
  26. data/spec/fixtures/cassettes/braintree/generate_token.yml +0 -63
  27. data/spec/fixtures/cassettes/braintree/token.yml +0 -63
  28. data/spec/fixtures/cassettes/checkout/invalid_credit_card.yml +0 -63
  29. data/spec/fixtures/cassettes/checkout/resubmit_credit_card.yml +0 -216
  30. data/spec/fixtures/cassettes/checkout/update.yml +0 -71
  31. data/spec/fixtures/cassettes/checkout/valid_credit_card.yml +0 -156
  32. data/spec/fixtures/cassettes/checkout/valid_venmo_transaction.yml +0 -599
  33. data/spec/fixtures/cassettes/gateway/authorize/credit_card/address.yml +0 -86
  34. data/spec/fixtures/cassettes/gateway/authorize/merchant_account/EUR.yml +0 -154
  35. data/spec/fixtures/cassettes/gateway/authorize/paypal/EUR.yml +0 -90
  36. data/spec/fixtures/cassettes/gateway/authorize/paypal/address.yml +0 -90
  37. data/spec/fixtures/cassettes/gateway/authorize.yml +0 -86
  38. data/spec/fixtures/cassettes/gateway/authorized_transaction.yml +0 -73
  39. data/spec/fixtures/cassettes/gateway/cancel/missing.yml +0 -63
  40. data/spec/fixtures/cassettes/gateway/cancel/refunds.yml +0 -272
  41. data/spec/fixtures/cassettes/gateway/cancel/void.yml +0 -201
  42. data/spec/fixtures/cassettes/gateway/capture.yml +0 -141
  43. data/spec/fixtures/cassettes/gateway/complete.yml +0 -157
  44. data/spec/fixtures/cassettes/gateway/credit.yml +0 -208
  45. data/spec/fixtures/cassettes/gateway/purchase.yml +0 -87
  46. data/spec/fixtures/cassettes/gateway/settled_transaction.yml +0 -140
  47. data/spec/fixtures/cassettes/gateway/void.yml +0 -137
  48. data/spec/fixtures/cassettes/source/card_type.yml +0 -267
  49. data/spec/fixtures/cassettes/source/last4.yml +0 -267
  50. data/spec/fixtures/cassettes/transaction/import/valid/capture.yml +0 -224
  51. data/spec/fixtures/cassettes/transaction/import/valid.yml +0 -71
  52. data/spec/fixtures/views/spree/orders/edit.html.erb +0 -50
  53. data/spec/helpers/solidus_paypal_braintree/braintree_admin_helper_spec.rb +0 -17
  54. data/spec/helpers/solidus_paypal_braintree/braintree_checkout_helper_spec.rb +0 -70
  55. data/spec/models/solidus_paypal_braintree/address_spec.rb +0 -71
  56. data/spec/models/solidus_paypal_braintree/avs_result_spec.rb +0 -317
  57. data/spec/models/solidus_paypal_braintree/gateway_spec.rb +0 -692
  58. data/spec/models/solidus_paypal_braintree/response_spec.rb +0 -280
  59. data/spec/models/solidus_paypal_braintree/source_spec.rb +0 -499
  60. data/spec/models/solidus_paypal_braintree/transaction_address_spec.rb +0 -235
  61. data/spec/models/solidus_paypal_braintree/transaction_import_spec.rb +0 -300
  62. data/spec/models/solidus_paypal_braintree/transaction_spec.rb +0 -85
  63. data/spec/models/spree/store_spec.rb +0 -14
  64. data/spec/requests/spree/api/orders_controller_spec.rb +0 -36
  65. data/spec/spec_helper.rb +0 -29
  66. data/spec/support/capybara.rb +0 -7
  67. data/spec/support/factories.rb +0 -2
  68. data/spec/support/gateway_helpers.rb +0 -29
  69. data/spec/support/order_ready_for_payment.rb +0 -37
  70. data/spec/support/vcr.rb +0 -42
  71. data/spec/support/views.rb +0 -1
@@ -1,235 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe SolidusPaypalBraintree::TransactionAddress do
4
- describe "#valid?" do
5
- subject { address.valid? }
6
-
7
- let(:address) { described_class.new(valid_attributes) }
8
-
9
- let(:valid_attributes) do
10
- {
11
- name: "Bruce Wayne",
12
- address_line_1: "42 Spruce Lane",
13
- city: "Gotham",
14
- zip: "98201",
15
- state_code: "WA",
16
- country_code: "US"
17
- }
18
- end
19
-
20
- let(:country) { create :country, iso: 'US', states_required: true }
21
-
22
- before do
23
- create :state, abbr: "WA", country: country
24
- end
25
-
26
- it { is_expected.to be true }
27
-
28
- context 'without country matches' do
29
- let(:valid_attributes) { super().merge({ country_code: 'CA' }) }
30
-
31
- it { is_expected.to be false }
32
- end
33
-
34
- context "without name" do
35
- let(:valid_attributes) { super().except(:name) }
36
-
37
- it { is_expected.to be false }
38
- end
39
-
40
- context "without address_line_1" do
41
- let(:valid_attributes) { super().except(:address_line_1) }
42
-
43
- it { is_expected.to be false }
44
- end
45
-
46
- context "without city" do
47
- let(:valid_attributes) { super().except(:city) }
48
-
49
- it { is_expected.to be false }
50
- end
51
-
52
- context "without zip" do
53
- let(:valid_attributes) { super().except(:zip) }
54
-
55
- it { is_expected.to be false }
56
- end
57
-
58
- context "without state_code" do
59
- let(:valid_attributes) { super().except(:state_code) }
60
-
61
- it { is_expected.to be false }
62
-
63
- context "when country does not requires states" do
64
- let(:country) { create :country, iso: 'US', states_required: false }
65
-
66
- it { is_expected.to be true }
67
- end
68
- end
69
-
70
- context "without country_code" do
71
- let(:valid_attributes) { super().except(:country_code) }
72
-
73
- it { is_expected.to be true }
74
-
75
- it "defaults to the US" do
76
- subject
77
- expect(address.country_code).to eq "us"
78
- end
79
- end
80
-
81
- context "with a one word name" do
82
- let(:valid_attributes) { super().merge({ name: "Bruce" }) }
83
-
84
- it { is_expected.to be true }
85
- end
86
- end
87
-
88
- describe "#attributes=" do
89
- subject { described_class.new(attrs) }
90
-
91
- context "when an ISO code is provided" do
92
- let(:attrs) { { country_code: "US" } }
93
-
94
- it "uses the ISO code provided" do
95
- expect(subject.country_code).to eq "US"
96
- end
97
- end
98
-
99
- context "when the ISO code is blank" do
100
- context "with a valid country name provided" do
101
- before do
102
- create :country, name: "canada", iso: "CA"
103
- end
104
-
105
- let(:attrs) { { country_name: "Canada" } }
106
-
107
- it "looks up the ISO code by the country name" do
108
- expect(subject.country_code).to eq "CA"
109
- end
110
- end
111
-
112
- context "without valid country name" do
113
- let(:attrs) { { country_name: "Neverland" } }
114
-
115
- it "leaves the country code blank" do
116
- expect(subject.country_code).to be_nil
117
- end
118
- end
119
- end
120
- end
121
-
122
- describe '#spree_country' do
123
- subject { described_class.new(country_code: country_code).spree_country }
124
-
125
- before do
126
- create :country, name: 'United States', iso: 'US'
127
- end
128
-
129
- ['us', 'US'].each do |code|
130
- let(:country_code) { code }
131
-
132
- it 'looks up by iso' do
133
- expect(subject.name).to eq 'United States'
134
- end
135
- end
136
-
137
- context 'when country does not exist' do
138
- let(:country_code) { 'NA' }
139
-
140
- it { is_expected.to be_nil }
141
- end
142
- end
143
-
144
- describe '#spree_state' do
145
- subject { described_class.new(country_code: 'US', state_code: state_code).spree_state }
146
-
147
- let(:state_code) { 'newy' }
148
-
149
- it { is_expected.to be_nil }
150
-
151
- context 'when state exists' do
152
- before do
153
- us = create :country, iso: 'US'
154
- create :state, abbr: 'NY', name: 'New York', country: us
155
- end
156
-
157
- ['ny', ' ny', 'ny ', 'New York', 'new york', 'NY'].each do |code|
158
- let(:state_code) { code }
159
-
160
- it 'looks up the right state' do
161
- expect(subject.abbr).to eq "NY"
162
- end
163
- end
164
-
165
- context 'with no matching state' do
166
- let(:state_code) { 'AL' }
167
-
168
- it { is_expected.to be_nil }
169
- end
170
- end
171
- end
172
-
173
- describe '#should_match_state_model' do
174
- subject { described_class.new(country_code: 'US').should_match_state_model? }
175
-
176
- it { is_expected.to be_falsey }
177
-
178
- context 'when country does not require states' do
179
- before { create :country, iso: 'US', states_required: false }
180
-
181
- it { is_expected.to be false }
182
- end
183
-
184
- context 'when country requires states' do
185
- before { create :country, iso: 'US', states_required: true }
186
-
187
- it { is_expected.to be true }
188
- end
189
- end
190
-
191
- describe '#to_spree_address' do
192
- subject { described_class.new(address_params).to_spree_address }
193
-
194
- let(:address_params) do
195
- {
196
- country_code: 'US',
197
- state_code: 'NY',
198
- name: "Alfred"
199
- }
200
- end
201
- let!(:us) { create :country, iso: 'US' }
202
-
203
- it { is_expected.to be_a Spree::Address }
204
-
205
- context 'when country exists with states' do
206
- before do
207
- create :state, country: us, abbr: 'NY', name: 'New York'
208
- end
209
-
210
- it 'uses state model' do
211
- expect(subject.state.name).to eq 'New York'
212
- end
213
- end
214
-
215
- context 'when country exist with no states' do
216
- it 'uses state_name' do
217
- expect(subject.state).to be_nil
218
- expect(subject.state_text).to eq 'NY'
219
- end
220
- end
221
-
222
- unless SolidusSupport.combined_first_and_last_name_in_address?
223
- context 'when using first_name and last_name' do
224
- let(:address_params) { super().merge({ first_name: "Bruce", last_name: "Wayne" }) }
225
-
226
- it 'displays a deprecation warning' do
227
- expect(Spree::Deprecation).to receive(:warn).
228
- with("first_name and last_name are deprecated. Use name instead.", any_args)
229
-
230
- subject
231
- end
232
- end
233
- end
234
- end
235
- end
@@ -1,300 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe SolidusPaypalBraintree::TransactionImport do
4
- let(:order) { Spree::Order.new }
5
- let!(:country) { create :country, iso: "US" }
6
- let(:braintree_gateway) { SolidusPaypalBraintree::Gateway.new }
7
- let(:transaction_address) { nil }
8
- let(:transaction) do
9
- SolidusPaypalBraintree::Transaction.new(
10
- nonce: 'abcd1234',
11
- payment_type: "ApplePayCard",
12
- address: transaction_address,
13
- payment_method: braintree_gateway,
14
- email: "test@example.com",
15
- phone: "123-456-6789"
16
- )
17
- end
18
- let(:transaction_import) { described_class.new(order, transaction) }
19
-
20
- describe "#valid?" do
21
- subject { transaction_import.valid? }
22
-
23
- it { is_expected.to be true }
24
-
25
- context "with invalid transaction" do
26
- let(:transaction) { SolidusPaypalBraintree::Transaction.new }
27
-
28
- it { is_expected.to be false }
29
- end
30
-
31
- context "with invalid address" do
32
- let(:transaction_address) do
33
- SolidusPaypalBraintree::TransactionAddress.new(
34
- name: "Bruce Wayne",
35
- address_line_1: "42 Spruce Lane",
36
- city: "Gotham",
37
- state_code: "WA",
38
- country_code: "US"
39
- )
40
- end
41
-
42
- it { is_expected.to be false }
43
-
44
- it "sets useful error messages" do
45
- transaction_import.valid?
46
- expect(transaction_import.errors.full_messages).
47
- to eq ["Address is invalid", "Address zip can't be blank"]
48
- end
49
- end
50
- end
51
-
52
- describe '#source' do
53
- subject { described_class.new(order, transaction).source }
54
-
55
- it { is_expected.to be_a SolidusPaypalBraintree::Source }
56
-
57
- it 'takes the nonce from the transaction' do
58
- expect(subject.nonce).to eq 'abcd1234'
59
- end
60
-
61
- it 'takes the payment type from the transaction' do
62
- expect(subject.payment_type).to eq 'ApplePayCard'
63
- end
64
-
65
- it 'takes the payment method from the transaction' do
66
- expect(subject.payment_method).to eq braintree_gateway
67
- end
68
-
69
- it 'takes the paypal funding source from the transaction' do
70
- transaction.paypal_funding_source = 'paypal'
71
-
72
- expect(subject.paypal_funding_source).to eq('paypal')
73
- end
74
-
75
- context 'when order has a user' do
76
- let(:user) { Spree.user_class.new }
77
- let(:order) { Spree::Order.new user: user }
78
-
79
- it 'associates user to the source' do
80
- expect(subject.user).to eq user
81
- end
82
- end
83
- end
84
-
85
- describe '#user' do
86
- subject { described_class.new(order, transaction).user }
87
-
88
- it { is_expected.to be_nil }
89
-
90
- context 'when order has a user' do
91
- let(:user) { Spree.user_class.new }
92
- let(:order) { Spree::Order.new user: user }
93
-
94
- it { is_expected.to eq user }
95
- end
96
- end
97
-
98
- describe '#import!' do
99
- subject { described_class.new(order, transaction).import!(end_state) }
100
-
101
- let(:store) { create :store }
102
- let(:variant) { create :variant }
103
- let(:line_item) { Spree::LineItem.new(variant: variant, quantity: 1, price: 10) }
104
- let(:address) { create :address, country: country }
105
- let(:order) {
106
- Spree::Order.create(
107
- number: "R999999999",
108
- store: store,
109
- line_items: [line_item],
110
- ship_address: address,
111
- currency: 'USD',
112
- total: 10,
113
- email: 'test@example.com'
114
- )
115
- }
116
- let(:payment_method) { create_gateway }
117
-
118
- let(:country) { create :country, iso: 'US', states_required: true }
119
- let(:transaction_address) { nil }
120
- let(:end_state) { 'confirm' }
121
-
122
- let(:transaction) do
123
- SolidusPaypalBraintree::Transaction.new(
124
- nonce: 'fake-valid-nonce',
125
- payment_method: payment_method,
126
- address: transaction_address,
127
- payment_type: SolidusPaypalBraintree::Source::PAYPAL,
128
- phone: '123-456-7890',
129
- email: 'user@example.com'
130
- )
131
- end
132
-
133
- before do
134
- # create a shipping method so we can push through to the end
135
- country
136
- create :shipping_method, cost: 5
137
-
138
- # ensure payments have the same number so VCR matches the request body
139
- allow_any_instance_of(Spree::Payment).
140
- to receive(:generate_identifier).
141
- and_return("ABCD1234")
142
- end
143
-
144
- context "with passing validation", vcr: {
145
- cassette_name: 'transaction/import/valid',
146
- match_requests_on: [:braintree_uri]
147
- } do
148
- context "when order end state is confirm" do
149
- it 'advances order to confirm state' do
150
- subject
151
- expect(order.state).to eq 'confirm'
152
- end
153
-
154
- it 'has a payment for the cost of line items + shipment' do
155
- subject
156
- expect(order.payments.first.amount).to eq 15
157
- end
158
-
159
- it 'is complete and capturable', aggregate_failures: true, vcr: {
160
- cassette_name: 'transaction/import/valid/capture',
161
- match_requests_on: [:braintree_uri]
162
- } do
163
- subject
164
- order.complete
165
-
166
- expect(order).to be_complete
167
- expect(order.payments.first).to be_pending
168
-
169
- order.payments.first.capture!
170
- # need to reload, as capture will update the order
171
- expect(order.reload).to be_paid
172
- end
173
- end
174
-
175
- context "when order end state is delivery" do
176
- let(:end_state) { 'delivery' }
177
-
178
- it "advances the order to delivery" do
179
- subject
180
- expect(order.state).to eq 'delivery'
181
- end
182
-
183
- it "has a payment for the cost of line items" do
184
- subject
185
- expect(order.payments.first.amount).to eq 10
186
- end
187
- end
188
-
189
- context 'when transaction has address' do
190
- let!(:new_york) { create :state, country: country, abbr: 'NY' }
191
-
192
- let(:transaction_address) do
193
- SolidusPaypalBraintree::TransactionAddress.new(
194
- country_code: 'US',
195
- name: 'Thaddeus Venture',
196
- city: 'New York',
197
- state_code: 'NY',
198
- address_line_1: '350 5th Ave',
199
- zip: '10118'
200
- )
201
- end
202
-
203
- it 'uses the new address', aggregate_failures: true do
204
- subject
205
- expect(order.shipping_address.address1).to eq '350 5th Ave'
206
- expect(order.shipping_address.country).to eq country
207
- expect(order.shipping_address.state).to eq new_york
208
- end
209
-
210
- context 'when transaction has paypal funding source' do
211
- it 'saves it to the payment source' do
212
- transaction.paypal_funding_source = 'paypal'
213
-
214
- subject
215
-
216
- source = SolidusPaypalBraintree::Source.last
217
- expect(source.paypal_funding_source).to eq('paypal')
218
- end
219
- end
220
-
221
- context 'with a tax category' do
222
- before do
223
- zone = Spree::Zone.create name: 'nyc tax'
224
- zone.members << Spree::ZoneMember.new(zoneable: new_york)
225
- create :tax_rate, zone: zone
226
- end
227
-
228
- it 'includes the tax in the payment' do
229
- subject
230
- expect(order.payments.first.amount).to eq 16
231
- end
232
- end
233
-
234
- context 'with a less expensive tax category' do
235
- before do
236
- original_zone = Spree::Zone.create name: 'first address tax'
237
- original_zone.members << Spree::ZoneMember.new(zoneable: address.state)
238
- original_tax_rate = create :tax_rate, zone: original_zone, amount: 0.2
239
-
240
- # new address is NY
241
- ny_zone = Spree::Zone.create name: 'nyc tax'
242
- ny_zone.members << Spree::ZoneMember.new(zoneable: new_york)
243
- create :tax_rate, tax_categories: [original_tax_rate.tax_categories.first], zone: ny_zone, amount: 0.1
244
- end
245
-
246
- it 'includes the lower tax in the payment' do
247
- # so shipments and shipment cost is calculated before transaction import
248
- order.next!; order.next!
249
- # precondition
250
- expect(order.additional_tax_total).to eq 2
251
- expect(order.total).to eq 17
252
-
253
- subject
254
- expect(order.additional_tax_total).to eq 1
255
- expect(order.payments.first.amount).to eq 16
256
- end
257
- end
258
- end
259
- end
260
-
261
- context "when validation fails" do
262
- let(:transaction_address) do
263
- SolidusPaypalBraintree::TransactionAddress.new(
264
- country_code: 'US',
265
- name: 'Thaddeus Venture',
266
- city: 'New York',
267
- state_code: 'NY',
268
- address_line_1: '350 5th Ave'
269
- )
270
- end
271
-
272
- it "raises an error with the validation messages" do
273
- expect { subject }.to raise_error(
274
- SolidusPaypalBraintree::TransactionImport::InvalidImportError
275
- )
276
- end
277
- end
278
-
279
- context "with checkout flow", vcr: {
280
- cassette_name: 'transaction/import/valid',
281
- match_requests_on: [:braintree_uri]
282
- } do
283
- it "is not restarted by default" do
284
- expect(order).not_to receive(:restart_checkout_flow)
285
- subject
286
- end
287
-
288
- context "with restart_checkout: true" do
289
- subject do
290
- described_class.new(order, transaction).import!(end_state, restart_checkout: true)
291
- end
292
-
293
- it "is restarted" do
294
- expect(order).to receive(:restart_checkout_flow)
295
- subject
296
- end
297
- end
298
- end
299
- end
300
- end
@@ -1,85 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe SolidusPaypalBraintree::Transaction do
4
- describe "#valid?" do
5
- subject { transaction.valid? }
6
-
7
- let(:valid_attributes) do
8
- {
9
- nonce: 'abcde-fghjkl-lmnop',
10
- payment_method: SolidusPaypalBraintree::Gateway.new,
11
- payment_type: 'ApplePayCard',
12
- email: "test@example.com"
13
- }
14
- end
15
- let(:valid_address_attributes) do
16
- {
17
- address_attributes: {
18
- name: "Bruce Wayne",
19
- address_line_1: "42 Spruce Lane",
20
- city: "Gotham",
21
- zip: "98201",
22
- state_code: "WA",
23
- country_code: "US"
24
- }
25
- }
26
- end
27
- let(:transaction) { described_class.new(valid_attributes) }
28
-
29
- before do
30
- create(:country, iso: "US")
31
- end
32
-
33
- it { is_expected.to be true }
34
-
35
- context 'without nonce' do
36
- let(:valid_attributes) { super().except(:nonce) }
37
-
38
- it { is_expected.to be false }
39
- end
40
-
41
- context 'without gateway' do
42
- let(:valid_attributes) { super().except(:payment_method) }
43
-
44
- it { is_expected.to be false }
45
- end
46
-
47
- context 'with bad gateway' do
48
- let(:valid_attributes) { super().merge(payment_method: Spree::PaymentMethod.new) }
49
-
50
- it { is_expected.to be false }
51
- end
52
-
53
- context 'without payment_type' do
54
- let(:valid_attributes) { super().except(:payment_type) }
55
-
56
- it { is_expected.to be false }
57
- end
58
-
59
- context 'without email' do
60
- let(:valid_attributes) { super().except(:email) }
61
-
62
- it { is_expected.to be false }
63
- end
64
-
65
- context "with valid address" do
66
- let(:valid_attributes) { super().merge(valid_address_attributes) }
67
-
68
- it { is_expected.to be true }
69
- end
70
-
71
- context "with invalid address" do
72
- let(:valid_attributes) { super().merge(valid_address_attributes) }
73
-
74
- before { valid_address_attributes[:address_attributes][:zip] = nil }
75
-
76
- it { is_expected.to be false }
77
-
78
- it "sets useful error messages" do
79
- transaction.valid?
80
- expect(transaction.errors.full_messages).
81
- to eq ["Address zip can't be blank"]
82
- end
83
- end
84
- end
85
- end
@@ -1,14 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Spree::Store do
4
- describe 'before_create :build_default_configuration' do
5
- context 'when a braintree_configuration record already exists' do
6
- it 'does not overwrite it' do
7
- store = build(:store)
8
- custom_braintree_configuration = store.build_braintree_configuration
9
- store.save!
10
- expect(store.braintree_configuration).to be custom_braintree_configuration
11
- end
12
- end
13
- end
14
- end
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Spree::Api::OrdersController, type: :request do
4
- stub_authorization!
5
-
6
- describe 'get show' do
7
- let(:gateway) { create_gateway }
8
- let(:order) { create(:order_with_line_items) }
9
- let(:source) do
10
- SolidusPaypalBraintree::Source.new(
11
- nonce: 'fake-valid-nonce',
12
- user: order.user,
13
- payment_type: SolidusPaypalBraintree::Source::PAYPAL,
14
- payment_method: gateway
15
- )
16
- end
17
-
18
- context 'when using braintree as the payment' do
19
- before do
20
- allow_any_instance_of(Spree::Payment).to receive(:create_payment_profile).and_return(true)
21
-
22
- order.payments.create!(
23
- payment_method: gateway,
24
- source: source,
25
- amount: 55
26
- )
27
- end
28
-
29
- it "can be rendered correctly" do
30
- get "/api/orders/#{order.number}"
31
-
32
- expect(response.status).to eq 200
33
- end
34
- end
35
- end
36
- end
data/spec/spec_helper.rb DELETED
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Configure Rails Environment
4
- ENV['RAILS_ENV'] ||= 'test'
5
-
6
- # Run Coverage report
7
- require 'solidus_dev_support/rspec/coverage'
8
-
9
- require File.expand_path('dummy/config/environment.rb', __dir__)
10
-
11
- require 'rails-controller-testing'
12
- Rails::Controller::Testing.install
13
-
14
- # Requires factories and other useful helpers defined in spree_core.
15
- require 'solidus_dev_support/rspec/feature_helper'
16
-
17
- # Requires supporting ruby files with custom matchers and macros, etc,
18
- # in spec/support/ and its subdirectories.
19
- Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].sort.each { |f| require f }
20
-
21
- # Requires factories defined in lib/solidus_paypal_braintree/factories.rb
22
- require 'solidus_paypal_braintree/factories'
23
-
24
- RSpec.configure do |config|
25
- config.infer_spec_type_from_file_location!
26
- config.use_transactional_fixtures = false
27
- config.raise_errors_for_deprecations!
28
- config.example_status_persistence_file_path = "./spec/examples.txt"
29
- end
@@ -1,7 +0,0 @@
1
- RSpec.configure do |config|
2
- config.before(:each, type: :feature, js: true) do
3
- page.driver.browser.manage.window.resize_to(1600, 1024)
4
- end
5
- end
6
-
7
- Capybara.javascript_driver = (ENV['CAPYBARA_DRIVER'] || :selenium_chrome).to_sym