openpay 1.0.10 → 2.0.0b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +7 -1
- data/Gemfile +2 -2
- data/README.md +2 -2
- data/Rakefile +2 -1
- data/lib/version.rb +1 -1
- data/openpay.gemspec +6 -6
- data/test/Factories.rb +16 -16
- data/test/spec/bankaccounts_spec.rb +19 -18
- data/test/spec/cards_spec.rb +35 -37
- data/test/spec/charges_spec.rb +44 -67
- data/test/spec/customers_spec.rb +11 -12
- data/test/spec/exceptions_spec.rb +2 -20
- data/test/spec/fees_spec.rb +22 -18
- data/test/spec/openpayresource_spec.rb +2 -2
- data/test/spec/payouts_spec.rb +39 -44
- data/test/spec/plans_spec.rb +14 -10
- data/test/spec/subscriptions_spec.rb +37 -36
- data/test/spec/transfers_spec.rb +35 -31
- data/test/spec_helper.rb +7 -1
- metadata +50 -51
- data/test/spec/webhook_spec.rb +0 -104
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e1b7adec4f451f0a6d4259b31ba6e05210b164
|
4
|
+
data.tar.gz: b7648ee2bffde1b2d6fe5b5087261390e25d792c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fd60be38a7319d926e0fc9e1cae8d4015415bb2bca90db27507cd9bdc4be30a0aafb079bdce6625299fbf2c1ae8a85ba914c14a6bea6222d84a6ace50c2f263
|
7
|
+
data.tar.gz: 62efb79c704390312cc6d2214813b22b3e0b84f7058bf08d4e175ed482bdc58cec61da696872839175c66de9550e683b56f9002ef4d75def45e4dd6e49d4ca00
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -2,8 +2,8 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gem 'rspec'
|
4
4
|
gem 'rspec-expectations'
|
5
|
-
gem '
|
6
|
-
gem '
|
5
|
+
gem 'factory_bot', '4.8.2'
|
6
|
+
gem 'rest-client', '~> 2.0', '>= 2.0.2'
|
7
7
|
|
8
8
|
# Specify your gem's dependencies in Openpay.gemspec
|
9
9
|
gemspec
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+

|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/open-pay/openpay-ruby)
|
4
4
|
|
5
5
|
[](http://badge.fury.io/rb/openpay)
|
6
6
|
|
data/Rakefile
CHANGED
data/lib/version.rb
CHANGED
data/openpay.gemspec
CHANGED
@@ -7,20 +7,20 @@ require 'version'
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = "openpay"
|
9
9
|
spec.version = Openpay::VERSION
|
10
|
-
spec.authors = ["ronnie_bermejo"]
|
11
|
-
spec.email = ["
|
12
|
-
spec.description = %q{ruby client for Openpay API services (version
|
10
|
+
spec.authors = ["Openpay","ronnie_bermejo"]
|
11
|
+
spec.email = ["hola@openpay.mx"]
|
12
|
+
spec.description = %q{ruby client for Openpay API services (version 2.0.0)}
|
13
13
|
spec.summary = %q{ruby api for openpay resources}
|
14
14
|
spec.homepage = "http://openpay.mx/"
|
15
|
-
spec.license = "Apache"
|
15
|
+
spec.license = "Apache-2.0"
|
16
16
|
|
17
17
|
spec.files = `git ls-files`.split($/)
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec)/})
|
20
20
|
spec.require_paths = ['lib','lib/openpay','openpay','.']
|
21
21
|
|
22
|
-
spec.add_runtime_dependency 'rest-client' , '~>
|
23
|
-
spec.add_runtime_dependency 'json'
|
22
|
+
spec.add_runtime_dependency 'rest-client' , '~>2.0'
|
23
|
+
spec.add_runtime_dependency 'json', '~> 1.8'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
26
26
|
spec.add_development_dependency 'rake'
|
data/test/Factories.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require '
|
1
|
+
require 'factory_bot'
|
2
2
|
|
3
3
|
|
4
|
-
|
4
|
+
FactoryBot.define do
|
5
5
|
|
6
6
|
factory :customer, class: Hash do
|
7
|
-
name '
|
8
|
-
last_name '
|
9
|
-
email '
|
7
|
+
name 'Guadalupe'
|
8
|
+
last_name 'Reyes'
|
9
|
+
email 'lupereyes@lemail.com'
|
10
10
|
phone_number '0180012345'
|
11
11
|
address { {
|
12
12
|
postal_code: '76190',
|
@@ -45,7 +45,7 @@ FactoryGirl.define do
|
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
factory :valid_card2, class: Hash do
|
49
49
|
|
50
50
|
bank_name 'visa'
|
51
51
|
holder_name 'Alma Olmos'
|
@@ -68,7 +68,7 @@ FactoryGirl.define do
|
|
68
68
|
|
69
69
|
end
|
70
70
|
|
71
|
-
|
71
|
+
factory :only_deposit, class: Hash do
|
72
72
|
|
73
73
|
bank_name 'visa'
|
74
74
|
holder_name 'Alma Olmos'
|
@@ -114,6 +114,7 @@ FactoryGirl.define do
|
|
114
114
|
|
115
115
|
end
|
116
116
|
|
117
|
+
|
117
118
|
factory :bank_account, class: Hash do
|
118
119
|
|
119
120
|
holder_name 'Juan Perez'
|
@@ -129,19 +130,20 @@ FactoryGirl.define do
|
|
129
130
|
amount "1000"
|
130
131
|
description "Cargo inicial a tarjeta"
|
131
132
|
source_id "string"
|
132
|
-
method "card"
|
133
|
+
add_attribute :method, "card"
|
133
134
|
order_id 'required'
|
134
135
|
|
135
136
|
initialize_with { attributes }
|
136
137
|
|
137
138
|
end
|
139
|
+
|
138
140
|
|
139
141
|
factory :bank_charge, class: Hash do
|
140
142
|
|
141
143
|
amount "10000"
|
142
144
|
description "Cargo con banco"
|
143
145
|
order_id 'required'
|
144
|
-
method "bank_account"
|
146
|
+
add_attribute :method, "bank_account"
|
145
147
|
|
146
148
|
initialize_with { attributes }
|
147
149
|
|
@@ -162,7 +164,7 @@ FactoryGirl.define do
|
|
162
164
|
|
163
165
|
factory :payout_card, class: Hash do
|
164
166
|
|
165
|
-
method 'card'
|
167
|
+
add_attribute :method, 'card'
|
166
168
|
destination_id '4444444444444448'
|
167
169
|
amount '2'
|
168
170
|
description 'Retiro de saldo semanal'
|
@@ -173,7 +175,7 @@ FactoryGirl.define do
|
|
173
175
|
|
174
176
|
factory :payout_bank_account, class: Hash do
|
175
177
|
|
176
|
-
method 'bank_account'
|
178
|
+
add_attribute :method, 'bank_account'
|
177
179
|
amount '1000'
|
178
180
|
destination_id 'required'
|
179
181
|
description 'Retiro de saldo semanal'
|
@@ -187,7 +189,7 @@ FactoryGirl.define do
|
|
187
189
|
amount '150.00'
|
188
190
|
status_after_retry 'cancelled'
|
189
191
|
retry_times 2
|
190
|
-
name '
|
192
|
+
add_attribute :name ,'TODO INCLUIDO'
|
191
193
|
repeat_unit 'week'
|
192
194
|
trial_days 30
|
193
195
|
repeat_every 1
|
@@ -209,16 +211,14 @@ FactoryGirl.define do
|
|
209
211
|
initialize_with { attributes }
|
210
212
|
end
|
211
213
|
|
212
|
-
|
213
|
-
|
214
214
|
factory :webhook1, class: Hash do
|
215
|
-
url '
|
215
|
+
url 'https://requestb.in/15r2d5n1'
|
216
216
|
event_types ['charge.succeeded','charge.created','charge.cancelled','charge.failed']
|
217
217
|
initialize_with { attributes }
|
218
218
|
end
|
219
219
|
|
220
220
|
factory :webhook2, class: Hash do
|
221
|
-
url '
|
221
|
+
url 'https://requestb.in/s3pj3ds3'
|
222
222
|
event_types ['charge.succeeded','charge.created','charge.cancelled','charge.failed']
|
223
223
|
initialize_with { attributes }
|
224
224
|
end
|
@@ -23,18 +23,19 @@ describe Bankaccounts do
|
|
23
23
|
expect(@bank_accounts).to respond_to(meth)
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
=begin
|
27
27
|
describe '.create' do
|
28
28
|
|
29
29
|
it 'creates a customer bank account' do
|
30
|
-
|
30
|
+
|
31
|
+
customer_hash= FactoryBot.build(:customer)
|
31
32
|
customer=@customers.create(customer_hash)
|
32
|
-
|
33
|
-
account_hash=
|
33
|
+
|
34
|
+
account_hash=FactoryBot.build(:bank_account)
|
34
35
|
bank=@bank_accounts.create(account_hash, customer['id'])
|
35
36
|
|
36
37
|
bank_account=@bank_accounts.get(customer['id'], bank['id'])
|
37
|
-
expect(bank_account['alias']).to match
|
38
|
+
expect(bank_account['alias']).to match "Cuenta principal"
|
38
39
|
|
39
40
|
@bank_accounts.delete(customer['id'], bank['id'])
|
40
41
|
@customers.delete(customer['id'])
|
@@ -42,15 +43,14 @@ describe Bankaccounts do
|
|
42
43
|
end
|
43
44
|
|
44
45
|
end
|
45
|
-
|
46
46
|
describe '.get' do
|
47
47
|
|
48
48
|
it 'get a given bank account for a given customer' do
|
49
49
|
|
50
|
-
customer_hash=
|
50
|
+
customer_hash= FactoryBot.build(:customer)
|
51
51
|
customer=@customers.create(customer_hash)
|
52
52
|
|
53
|
-
account_hash=
|
53
|
+
account_hash=FactoryBot.build(:bank_account)
|
54
54
|
bank=@bank_accounts.create(account_hash, customer['id'])
|
55
55
|
|
56
56
|
bank_account=@bank_accounts.get(customer['id'], bank['id'])
|
@@ -66,10 +66,10 @@ describe Bankaccounts do
|
|
66
66
|
|
67
67
|
it 'iterator for all given customer bank accounts' do
|
68
68
|
|
69
|
-
customer_hash=
|
69
|
+
customer_hash= FactoryBot.build(:customer)
|
70
70
|
customer=@customers.create(customer_hash)
|
71
71
|
|
72
|
-
account_hash=
|
72
|
+
account_hash=FactoryBot.build(:bank_account)
|
73
73
|
bank=@bank_accounts.create(account_hash, customer['id'])
|
74
74
|
|
75
75
|
@bank_accounts.each(customer['id']) do |bank_account|
|
@@ -87,11 +87,11 @@ describe Bankaccounts do
|
|
87
87
|
|
88
88
|
it 'list the bank accounts using a given filter' do
|
89
89
|
|
90
|
-
customer_hash=
|
90
|
+
customer_hash= FactoryBot.build(:customer)
|
91
91
|
customer=@customers.create(customer_hash)
|
92
92
|
expect(@bank_accounts.all(customer['id']).size).to be 0
|
93
93
|
|
94
|
-
account_hash=
|
94
|
+
account_hash=FactoryBot.build(:bank_account)
|
95
95
|
bank=@bank_accounts.create(account_hash, customer['id'])
|
96
96
|
expect(@bank_accounts.all(customer['id']).size).to be 1
|
97
97
|
|
@@ -111,11 +111,11 @@ describe Bankaccounts do
|
|
111
111
|
|
112
112
|
it 'all bank accounts for a given customer' do
|
113
113
|
|
114
|
-
customer_hash=
|
114
|
+
customer_hash= FactoryBot.build(:customer)
|
115
115
|
customer=@customers.create(customer_hash)
|
116
116
|
expect(@bank_accounts.all(customer['id']).size).to be 0
|
117
117
|
|
118
|
-
account_hash=
|
118
|
+
account_hash=FactoryBot.build(:bank_account)
|
119
119
|
bank=@bank_accounts.create(account_hash, customer['id'])
|
120
120
|
expect(@bank_accounts.all(customer['id']).size).to be 1
|
121
121
|
|
@@ -134,11 +134,11 @@ describe Bankaccounts do
|
|
134
134
|
|
135
135
|
it 'deletes a given bank account' do
|
136
136
|
|
137
|
-
customer_hash=
|
137
|
+
customer_hash= FactoryBot.build(:customer)
|
138
138
|
customer=@customers.create(customer_hash)
|
139
139
|
expect(@bank_accounts.all(customer['id']).size).to be 0
|
140
140
|
|
141
|
-
account_hash=
|
141
|
+
account_hash=FactoryBot.build(:bank_account)
|
142
142
|
bank=@bank_accounts.create(account_hash, customer['id'])
|
143
143
|
expect(@bank_accounts.all(customer['id']).size).to be 1
|
144
144
|
|
@@ -157,10 +157,10 @@ describe Bankaccounts do
|
|
157
157
|
|
158
158
|
it 'deletes all bank accounts' do
|
159
159
|
|
160
|
-
customer_hash=
|
160
|
+
customer_hash= FactoryBot.build(:customer)
|
161
161
|
customer=@customers.create(customer_hash)
|
162
162
|
|
163
|
-
account_hash=
|
163
|
+
account_hash=FactoryBot.build(:bank_account)
|
164
164
|
|
165
165
|
@bank_accounts.create(account_hash, customer['id'])
|
166
166
|
expect(@bank_accounts.all(customer['id']).size).to be 1
|
@@ -179,4 +179,5 @@ describe Bankaccounts do
|
|
179
179
|
end
|
180
180
|
|
181
181
|
end
|
182
|
+
=end
|
182
183
|
end
|
data/test/spec/cards_spec.rb
CHANGED
@@ -36,7 +36,7 @@ describe Cards do
|
|
36
36
|
it 'creates merchant card' do
|
37
37
|
|
38
38
|
#creates merchant card
|
39
|
-
card_hash =
|
39
|
+
card_hash = FactoryBot.build(:valid_card)
|
40
40
|
cards=@cards.create(card_hash)
|
41
41
|
expect(cards).to be_a(Hash)
|
42
42
|
|
@@ -56,9 +56,9 @@ describe Cards do
|
|
56
56
|
it 'creates a customer card' do
|
57
57
|
|
58
58
|
#creates a customer
|
59
|
-
card_hash =
|
59
|
+
card_hash = FactoryBot.build(:valid_card, holder_name: 'Pepe')
|
60
60
|
customers=@openpay.create(:customers)
|
61
|
-
customer_hash =
|
61
|
+
customer_hash = FactoryBot.build(:customer)
|
62
62
|
customer=customers.create(customer_hash)
|
63
63
|
|
64
64
|
#creates a customer card
|
@@ -82,35 +82,33 @@ describe Cards do
|
|
82
82
|
|
83
83
|
end
|
84
84
|
|
85
|
-
it '
|
85
|
+
it 'create an existing merchant card' do
|
86
86
|
|
87
87
|
#creates merchant card
|
88
|
-
card_hash =
|
88
|
+
card_hash = FactoryBot.build(:valid_card)
|
89
|
+
|
90
|
+
card=@cards.create(card_hash)
|
91
|
+
#cleanup
|
92
|
+
@cards.delete(card['id'])
|
93
|
+
|
89
94
|
card=@cards.create(card_hash)
|
90
|
-
|
91
|
-
#perform check
|
92
|
-
expect { @cards.create(card_hash) }.to raise_error(OpenpayTransactionException)
|
93
|
-
|
94
95
|
#cleanup
|
95
96
|
@cards.delete(card['id'])
|
96
97
|
|
97
98
|
end
|
98
99
|
|
99
|
-
it '
|
100
|
+
it 'trying to create an existing customer card' do
|
100
101
|
|
101
102
|
#creates a customer
|
102
|
-
card_hash =
|
103
|
+
card_hash = FactoryBot.build(:valid_card, holder_name: 'Pepe')
|
103
104
|
customers=@openpay.create(:customers)
|
104
|
-
customer_hash =
|
105
|
+
customer_hash = FactoryBot.build(:customer)
|
105
106
|
customer=customers.create(customer_hash)
|
106
107
|
|
107
108
|
#creates a customer card
|
108
109
|
card=@cards.create(card_hash, customer['id'])
|
109
110
|
expect(card).to be_a(Hash)
|
110
111
|
|
111
|
-
#performs check
|
112
|
-
expect { @cards.create(card_hash, customer['id']) }.to raise_error(OpenpayTransactionException)
|
113
|
-
|
114
112
|
#cleanup
|
115
113
|
@cards.delete(card['id'], customer['id'])
|
116
114
|
@customers.delete(customer['id'])
|
@@ -118,7 +116,7 @@ describe Cards do
|
|
118
116
|
end
|
119
117
|
|
120
118
|
it 'fails when using an expired card' do
|
121
|
-
card_hash =
|
119
|
+
card_hash = FactoryBot.build(:expired_card)
|
122
120
|
#check
|
123
121
|
expect { @cards.create(card_hash) }.to raise_error(OpenpayTransactionException)
|
124
122
|
#extended check
|
@@ -132,7 +130,7 @@ describe Cards do
|
|
132
130
|
end
|
133
131
|
|
134
132
|
it 'fails when using a stolen card' do
|
135
|
-
card_json =
|
133
|
+
card_json = FactoryBot.build(:valid_card, card_number: '4000000000000119')
|
136
134
|
expect { @cards.create(card_json) }.to raise_error(OpenpayTransactionException)
|
137
135
|
end
|
138
136
|
|
@@ -149,9 +147,9 @@ describe Cards do
|
|
149
147
|
it 'iterates over all existing customer cards' do
|
150
148
|
|
151
149
|
#creates a customer
|
152
|
-
card_hash =
|
150
|
+
card_hash = FactoryBot.build(:valid_card, holder_name: 'Pepe')
|
153
151
|
customers=@openpay.create(:customers)
|
154
|
-
customer_hash =
|
152
|
+
customer_hash = FactoryBot.build(:customer)
|
155
153
|
customer=customers.create(customer_hash)
|
156
154
|
|
157
155
|
#creates a customer card
|
@@ -175,7 +173,7 @@ describe Cards do
|
|
175
173
|
it 'deletes a merchant card' do
|
176
174
|
|
177
175
|
#creates merchant card
|
178
|
-
card_hash =
|
176
|
+
card_hash = FactoryBot.build(:valid_card)
|
179
177
|
cards=@cards.create(card_hash)
|
180
178
|
expect(cards).to be_a(Hash)
|
181
179
|
|
@@ -196,11 +194,11 @@ describe Cards do
|
|
196
194
|
|
197
195
|
#create customer
|
198
196
|
customers=@openpay.create(:customers)
|
199
|
-
customer_hash =
|
197
|
+
customer_hash = FactoryBot.build(:customer, name: 'Juan', last_name: 'Paez')
|
200
198
|
customer=customers.create(customer_hash)
|
201
199
|
|
202
200
|
#create customer card
|
203
|
-
card_hash =
|
201
|
+
card_hash = FactoryBot.build(:valid_card)
|
204
202
|
card=@cards.create(card_hash, customer['id'])
|
205
203
|
|
206
204
|
#delete card
|
@@ -223,7 +221,7 @@ describe Cards do
|
|
223
221
|
|
224
222
|
#create merchant card
|
225
223
|
bank_name='Banamex'
|
226
|
-
card_hash =
|
224
|
+
card_hash = FactoryBot.build(:valid_card)
|
227
225
|
|
228
226
|
card=@cards.create(card_hash)
|
229
227
|
id=card['id']
|
@@ -245,12 +243,12 @@ describe Cards do
|
|
245
243
|
it ' gets an existing customer card' do
|
246
244
|
|
247
245
|
#create customer
|
248
|
-
customer_hash =
|
246
|
+
customer_hash = FactoryBot.build(:customer)
|
249
247
|
customer=@customers.create(customer_hash)
|
250
248
|
|
251
249
|
#creates card
|
252
250
|
bank_name='Banamex'
|
253
|
-
card_hash =
|
251
|
+
card_hash = FactoryBot.build(:valid_card)
|
254
252
|
card=@cards.create(card_hash, customer['id'])
|
255
253
|
id=card['id']
|
256
254
|
|
@@ -280,7 +278,7 @@ describe Cards do
|
|
280
278
|
expect(@cards.all.size).to be 0
|
281
279
|
|
282
280
|
#create merchant card
|
283
|
-
card_hash =
|
281
|
+
card_hash = FactoryBot.build(:valid_card)
|
284
282
|
card=@cards.create(card_hash)
|
285
283
|
id=card['id']
|
286
284
|
|
@@ -295,14 +293,14 @@ describe Cards do
|
|
295
293
|
it 'all customer cards' do
|
296
294
|
|
297
295
|
#create customer
|
298
|
-
customer_hash =
|
296
|
+
customer_hash = FactoryBot.build(:customer)
|
299
297
|
customer=@customers.create(customer_hash)
|
300
298
|
|
301
299
|
#check initial state
|
302
300
|
expect(@cards.all(customer['id']).size).to be 0
|
303
301
|
|
304
302
|
#create customer card
|
305
|
-
card_hash =
|
303
|
+
card_hash = FactoryBot.build(:valid_card)
|
306
304
|
card=@cards.create(card_hash, customer['id'])
|
307
305
|
id=card['id']
|
308
306
|
|
@@ -325,10 +323,10 @@ describe Cards do
|
|
325
323
|
it 'list the merchant cards using a filter' do
|
326
324
|
|
327
325
|
#create merchant card
|
328
|
-
card_hash =
|
326
|
+
card_hash = FactoryBot.build(:valid_card)
|
329
327
|
card1 = @cards.create(card_hash)
|
330
328
|
|
331
|
-
card_hash =
|
329
|
+
card_hash = FactoryBot.build(:valid_card2)
|
332
330
|
card2 = @cards.create(card_hash)
|
333
331
|
|
334
332
|
search_params = OpenpayUtils::SearchParams.new
|
@@ -340,18 +338,18 @@ describe Cards do
|
|
340
338
|
it 'list the customer cards using a filter' do
|
341
339
|
|
342
340
|
#create customer
|
343
|
-
customer_hash =
|
341
|
+
customer_hash = FactoryBot.build(:customer)
|
344
342
|
customer = @customers.create(customer_hash)
|
345
343
|
|
346
344
|
#creates card
|
347
345
|
bank_name ='Banamex'
|
348
|
-
card_hash =
|
346
|
+
card_hash = FactoryBot.build(:valid_card)
|
349
347
|
card = @cards.create(card_hash, customer['id'])
|
350
348
|
id = card['id']
|
351
349
|
|
352
350
|
#creates card 2
|
353
351
|
bank_name = 'Bancomer'
|
354
|
-
card_hash =
|
352
|
+
card_hash = FactoryBot.build(:valid_card2)
|
355
353
|
card = @cards.create(card_hash, customer['id'])
|
356
354
|
id = card['id']
|
357
355
|
|
@@ -381,11 +379,11 @@ describe Cards do
|
|
381
379
|
it 'deletes all existing merchant cards' do
|
382
380
|
|
383
381
|
#create merchant card
|
384
|
-
card_hash =
|
382
|
+
card_hash = FactoryBot.build(:valid_card)
|
385
383
|
@cards.create(card_hash)
|
386
384
|
|
387
385
|
#using json just for fun ...and test
|
388
|
-
card2_json =
|
386
|
+
card2_json = FactoryBot.build(:valid_card2).to_json
|
389
387
|
@cards.create(card2_json)
|
390
388
|
|
391
389
|
#perform check
|
@@ -402,14 +400,14 @@ describe Cards do
|
|
402
400
|
it 'deletes all existing cards for a given customer' do
|
403
401
|
|
404
402
|
#creates customer
|
405
|
-
customer_hash =
|
403
|
+
customer_hash = FactoryBot.build(:customer)
|
406
404
|
customer=@customers.create(customer_hash)
|
407
405
|
|
408
406
|
#check initial state
|
409
407
|
expect(@cards.all(customer['id']).size).to be 0
|
410
408
|
|
411
409
|
#create card
|
412
|
-
card_hash =
|
410
|
+
card_hash = FactoryBot.build(:valid_card)
|
413
411
|
card=@cards.create(card_hash, customer['id'])
|
414
412
|
|
415
413
|
#perform check
|