質問編集履歴
5
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -364,6 +364,100 @@
|
|
364
364
|
|
365
365
|
```
|
366
366
|
|
367
|
+
```
|
368
|
+
|
369
|
+
FactoryBot.define do
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
factory :item do
|
374
|
+
|
375
|
+
name {"abe"}
|
376
|
+
|
377
|
+
detail {"aaa"}
|
378
|
+
|
379
|
+
category_id {"1"}
|
380
|
+
|
381
|
+
condition {"1"}
|
382
|
+
|
383
|
+
fee {"1"}
|
384
|
+
|
385
|
+
prefecture {"aaa"}
|
386
|
+
|
387
|
+
delivery_date {"1"}
|
388
|
+
|
389
|
+
price {"111"}
|
390
|
+
|
391
|
+
end
|
392
|
+
|
393
|
+
end
|
394
|
+
|
395
|
+
```
|
396
|
+
|
397
|
+
**image_spec.rb**
|
398
|
+
|
399
|
+
```
|
400
|
+
|
401
|
+
require 'rails_helper'
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
describe Image do
|
406
|
+
|
407
|
+
before do
|
408
|
+
|
409
|
+
@image = build(:image)
|
410
|
+
|
411
|
+
end
|
412
|
+
|
413
|
+
describe "create" do
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
it "画像入力されていれば出品できる" do
|
418
|
+
|
419
|
+
image = FactoryBot.build(:image)
|
420
|
+
|
421
|
+
expect(image).to be_valid
|
422
|
+
|
423
|
+
end
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
it "商品画像が空では出品できない" do
|
428
|
+
|
429
|
+
image = FactoryBot.build(:image, image: "")
|
430
|
+
|
431
|
+
image.valid?
|
432
|
+
|
433
|
+
expect(image.error(:image)).to include("can`t be blank")
|
434
|
+
|
435
|
+
end
|
436
|
+
|
437
|
+
end
|
438
|
+
|
439
|
+
end
|
440
|
+
|
441
|
+
```
|
442
|
+
|
443
|
+
**images.rb**
|
444
|
+
|
445
|
+
```
|
446
|
+
|
447
|
+
FactoryBot.define do
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
factory :image do
|
452
|
+
|
453
|
+
image {"aaa.jpg"}
|
454
|
+
|
455
|
+
end
|
456
|
+
|
457
|
+
end
|
458
|
+
|
459
|
+
```
|
460
|
+
|
367
461
|
**.rspec**
|
368
462
|
|
369
463
|
```
|
4
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
正直どこを直したらいいのか調べても全く分からない状況です。
|
4
4
|
|
5
|
+
binding.pryもなぜか効きません。
|
6
|
+
|
5
7
|
すみませんがわかる方がいらしゃいましたら教えていただけると助かります。
|
6
8
|
|
7
9
|
よろしくお願い致します。
|
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,29 +22,27 @@
|
|
22
22
|
|
23
23
|
Item
|
24
24
|
|
25
|
-
|
25
|
+
#create
|
26
|
-
|
26
|
+
|
27
|
-
|
27
|
+
商品名、価格、商品説明、カテゴリー、商品状態、配送料の負担、発送元の地域、発送までの日数、が入力されていれば出品できる (FAILED - 1)
|
28
|
-
|
29
|
-
|
28
|
+
|
30
|
-
|
31
|
-
商品名が空では出品できない (FAILED -
|
29
|
+
商品名が空では出品できない (FAILED - 2)
|
32
|
-
|
30
|
+
|
33
|
-
商品説明が空では出品できない (FAILED -
|
31
|
+
商品説明が空では出品できない (FAILED - 3)
|
34
|
-
|
32
|
+
|
35
|
-
カテゴリーが空では出品できない (FAILED -
|
33
|
+
カテゴリーが空では出品できない (FAILED - 4)
|
36
|
-
|
34
|
+
|
37
|
-
商品の状態が空では出品できない (FAILED -
|
35
|
+
商品の状態が空では出品できない (FAILED - 5)
|
38
|
-
|
36
|
+
|
39
|
-
配送料の負担が空では出品できない (FAILED -
|
37
|
+
配送料の負担が空では出品できない (FAILED - 6)
|
40
|
-
|
38
|
+
|
41
|
-
配送元の地域が空では出品できない (FAILED -
|
39
|
+
配送元の地域が空では出品できない (FAILED - 7)
|
42
|
-
|
40
|
+
|
43
|
-
発送までの日数が空では出品できない (FAILED -
|
41
|
+
発送までの日数が空では出品できない (FAILED - 8)
|
44
|
-
|
42
|
+
|
45
|
-
価格が空では出品できない (FAILED -
|
43
|
+
価格が空では出品できない (FAILED - 9)
|
46
|
-
|
44
|
+
|
47
|
-
価格が数字でない場合(文字列の場合)は、出品できない (FAILED - 1
|
45
|
+
価格が数字でない場合(文字列の場合)は、出品できない (FAILED - 10)
|
48
46
|
|
49
47
|
|
50
48
|
|
@@ -52,163 +50,149 @@
|
|
52
50
|
|
53
51
|
|
54
52
|
|
55
|
-
1) Item
|
53
|
+
1) Item#create 商品名、価格、商品説明、カテゴリー、商品状態、配送料の負担、発送元の地域、発送までの日数、が入力されていれば出品できる
|
56
|
-
|
54
|
+
|
57
|
-
Failure/Error:
|
55
|
+
Failure/Error: item = build(:item)
|
58
56
|
|
59
57
|
|
60
58
|
|
61
59
|
NoMethodError:
|
62
60
|
|
63
|
-
undefined method `build' for #<RSpec::ExampleGroups::Item::
|
64
|
-
|
65
|
-
# ./spec/models/item_spec.rb:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
2) Item
|
70
|
-
|
71
|
-
Failure/Error:
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
# ./spec/models/item_spec.rb:
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
3) Item
|
84
|
-
|
85
|
-
Failure/Error:
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
# ./spec/models/item_spec.rb:
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
4) Item
|
98
|
-
|
99
|
-
Failure/Error:
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
# ./spec/models/item_spec.rb:
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
5) Item
|
112
|
-
|
113
|
-
Failure/Error:
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
# ./spec/models/item_spec.rb:
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
6) Item
|
126
|
-
|
127
|
-
Failure/Error:
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
# ./spec/models/item_spec.rb:
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
7) Item
|
140
|
-
|
141
|
-
Failure/Error:
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
# ./spec/models/item_spec.rb:
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
8) Item
|
154
|
-
|
155
|
-
Failure/Error:
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
# ./spec/models/item_spec.rb:5:in `block (
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
9) Item
|
168
|
-
|
169
|
-
Failure/Error:
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
# ./spec/models/item_spec.rb:5:in `block (
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
10) Item
|
182
|
-
|
183
|
-
Failure/Error:
|
61
|
+
undefined method `build' for #<RSpec::ExampleGroups::Item::Create:0x00007fd9b7ca5c18>
|
62
|
+
|
63
|
+
# ./spec/models/item_spec.rb:7:in `block (3 levels) in <top (required)>'
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
2) Item#create 商品名が空では出品できない
|
68
|
+
|
69
|
+
Failure/Error: item = FactoryBot.build(:item, name: "")
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
ArgumentError:
|
74
|
+
|
75
|
+
'1' is not a valid condition
|
76
|
+
|
77
|
+
# ./spec/models/item_spec.rb:13:in `block (3 levels) in <top (required)>'
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
3) Item#create 商品説明が空では出品できない
|
82
|
+
|
83
|
+
Failure/Error: item = FactoryBot.build(:item, detail: "")
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
ArgumentError:
|
88
|
+
|
89
|
+
'1' is not a valid condition
|
90
|
+
|
91
|
+
# ./spec/models/item_spec.rb:20:in `block (3 levels) in <top (required)>'
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
4) Item#create カテゴリーが空では出品できない
|
96
|
+
|
97
|
+
Failure/Error: item = FactoryBot.build(:item, category_id: "")
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
ArgumentError:
|
102
|
+
|
103
|
+
'1' is not a valid condition
|
104
|
+
|
105
|
+
# ./spec/models/item_spec.rb:26:in `block (3 levels) in <top (required)>'
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
5) Item#create 商品の状態が空では出品できない
|
110
|
+
|
111
|
+
Failure/Error: item = FactoryBot.build(:item, condition: "")
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
ArgumentError:
|
116
|
+
|
117
|
+
'1' is not a valid fee
|
118
|
+
|
119
|
+
# ./spec/models/item_spec.rb:32:in `block (3 levels) in <top (required)>'
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
6) Item#create 配送料の負担が空では出品できない
|
124
|
+
|
125
|
+
Failure/Error: item = FactoryBot.build(:item, delivery_fee: "")
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
ArgumentError:
|
130
|
+
|
131
|
+
'1' is not a valid condition
|
132
|
+
|
133
|
+
# ./spec/models/item_spec.rb:38:in `block (3 levels) in <top (required)>'
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
7) Item#create 配送元の地域が空では出品できない
|
138
|
+
|
139
|
+
Failure/Error: item = FactoryBot.build(:item, city: "")
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
ArgumentError:
|
144
|
+
|
145
|
+
'1' is not a valid condition
|
146
|
+
|
147
|
+
# ./spec/models/item_spec.rb:44:in `block (3 levels) in <top (required)>'
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
8) Item#create 発送までの日数が空では出品できない
|
152
|
+
|
153
|
+
Failure/Error: item = FactoryBot.build(:item, delivery_date: "")
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
ArgumentError:
|
158
|
+
|
159
|
+
'1' is not a valid condition
|
160
|
+
|
161
|
+
# ./spec/models/item_spec.rb:50:in `block (3 levels) in <top (required)>'
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
9) Item#create 価格が空では出品できない
|
166
|
+
|
167
|
+
Failure/Error: item = FactoryBot.build(:item, price: "")
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
ArgumentError:
|
172
|
+
|
173
|
+
'1' is not a valid condition
|
174
|
+
|
175
|
+
# ./spec/models/item_spec.rb:56:in `block (3 levels) in <top (required)>'
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
10) Item#create 価格が数字でない場合(文字列の場合)は、出品できない
|
180
|
+
|
181
|
+
Failure/Error: item = FactoryBot.build(:item, price: "aaaa")
|
184
182
|
|
185
183
|
|
186
184
|
|
187
|
-
|
185
|
+
ArgumentError:
|
188
|
-
|
186
|
+
|
189
|
-
|
187
|
+
'1' is not a valid condition
|
190
|
-
|
188
|
+
|
191
|
-
# ./spec/models/item_spec.rb:
|
189
|
+
# ./spec/models/item_spec.rb:62:in `block (3 levels) in <top (required)>'
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
190
|
+
|
196
|
-
|
197
|
-
|
191
|
+
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
192
|
+
|
202
|
-
|
203
|
-
undefined method `build' for #<RSpec::ExampleGroups::Item::ValidCreate:0x00007faac77fa778>
|
204
|
-
|
205
|
-
# ./spec/models/item_spec.rb:5:in `block (2 levels) in <top (required)>'
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
Finished in 0.0
|
193
|
+
Finished in 0.08192 seconds (files took 3.77 seconds to load)
|
210
|
-
|
194
|
+
|
211
|
-
1
|
195
|
+
10 examples, 10 failures
|
212
196
|
|
213
197
|
|
214
198
|
|
@@ -216,27 +200,23 @@
|
|
216
200
|
|
217
201
|
|
218
202
|
|
219
|
-
rspec ./spec/models/item_spec.rb:
|
203
|
+
rspec ./spec/models/item_spec.rb:6 # Item#create 商品名、価格、商品説明、カテゴリー、商品状態、配送料の負担、発送元の地域、発送までの日数、が入力されていれば出品できる
|
220
|
-
|
221
|
-
|
204
|
+
|
222
|
-
|
223
|
-
rspec ./spec/models/item_spec.rb:2
|
205
|
+
rspec ./spec/models/item_spec.rb:12 # Item#create 商品名が空では出品できない
|
224
|
-
|
206
|
+
|
225
|
-
rspec ./spec/models/item_spec.rb:
|
207
|
+
rspec ./spec/models/item_spec.rb:19 # Item#create 商品説明が空では出品できない
|
226
|
-
|
208
|
+
|
227
|
-
rspec ./spec/models/item_spec.rb:
|
209
|
+
rspec ./spec/models/item_spec.rb:25 # Item#create カテゴリーが空では出品できない
|
228
|
-
|
210
|
+
|
229
|
-
rspec ./spec/models/item_spec.rb:3
|
211
|
+
rspec ./spec/models/item_spec.rb:31 # Item#create 商品の状態が空では出品できない
|
230
|
-
|
212
|
+
|
231
|
-
rspec ./spec/models/item_spec.rb:
|
213
|
+
rspec ./spec/models/item_spec.rb:37 # Item#create 配送料の負担が空では出品できない
|
232
|
-
|
214
|
+
|
233
|
-
rspec ./spec/models/item_spec.rb:
|
215
|
+
rspec ./spec/models/item_spec.rb:43 # Item#create 配送元の地域が空では出品できない
|
234
|
-
|
216
|
+
|
235
|
-
rspec ./spec/models/item_spec.rb:
|
217
|
+
rspec ./spec/models/item_spec.rb:49 # Item#create 発送までの日数が空では出品できない
|
236
|
-
|
218
|
+
|
237
|
-
rspec ./spec/models/item_spec.rb:
|
219
|
+
rspec ./spec/models/item_spec.rb:55 # Item#create 価格が空では出品できない
|
238
|
-
|
239
|
-
rspec ./spec/models/item_spec.rb:68 # Item valid_create 価格が数字でない場合(文字列の場合)は、出品できない
|
240
220
|
|
241
221
|
```
|
242
222
|
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -252,146 +252,132 @@
|
|
252
252
|
|
253
253
|
describe Item do
|
254
254
|
|
255
|
-
be
|
255
|
+
describe "#create" do
|
256
|
+
|
257
|
+
|
258
|
+
|
256
|
-
|
259
|
+
it "商品名、価格、商品説明、カテゴリー、商品状態、配送料の負担、発送元の地域、発送までの日数、が入力されていれば出品できる" do
|
260
|
+
|
257
|
-
|
261
|
+
item = build(:item)
|
262
|
+
|
263
|
+
binding.pry
|
264
|
+
|
265
|
+
expect(item).to be_valid
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
it "商品名が空では出品できない" do
|
272
|
+
|
273
|
+
item = FactoryBot.build(:item, name: "")
|
274
|
+
|
275
|
+
item.valid?
|
276
|
+
|
277
|
+
binding.pry
|
278
|
+
|
279
|
+
expect(item.errors[:name]).to include("can't be blank")
|
280
|
+
|
281
|
+
end
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
it "商品説明が空では出品できない" do
|
286
|
+
|
287
|
+
item = FactoryBot.build(:item, detail: "")
|
288
|
+
|
289
|
+
item.valid?
|
290
|
+
|
291
|
+
expect(item.errors[:detail]).to include("can't be blank")
|
292
|
+
|
293
|
+
end
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
it "カテゴリーが空では出品できない" do
|
298
|
+
|
299
|
+
item = FactoryBot.build(:item, category_id: "")
|
300
|
+
|
301
|
+
item.valid?
|
302
|
+
|
303
|
+
expect(item.errors[:category_id]).to include("can't be blank")
|
304
|
+
|
305
|
+
end
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
it "商品の状態が空では出品できない" do
|
310
|
+
|
311
|
+
item = FactoryBot.build(:item, condition: "")
|
312
|
+
|
313
|
+
item.valid?
|
314
|
+
|
315
|
+
expect(item.errors[:condition]).to include("can't be blank")
|
316
|
+
|
317
|
+
end
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
it "配送料の負担が空では出品できない" do
|
322
|
+
|
323
|
+
item = FactoryBot.build(:item, delivery_fee: "")
|
324
|
+
|
325
|
+
item.valid?
|
326
|
+
|
327
|
+
expect(item.errors[:delivery_fee]).to include("can't be blank")
|
328
|
+
|
329
|
+
end
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
it "配送元の地域が空では出品できない" do
|
334
|
+
|
335
|
+
item = FactoryBot.build(:item, city: "")
|
336
|
+
|
337
|
+
item.valid?
|
338
|
+
|
339
|
+
expect(item.errors[:city]).to include("can't be blank")
|
340
|
+
|
341
|
+
end
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
it "発送までの日数が空では出品できない" do
|
346
|
+
|
347
|
+
item = FactoryBot.build(:item, delivery_date: "")
|
348
|
+
|
349
|
+
item.valid?
|
350
|
+
|
351
|
+
expect(item.errors[:delivery_date]).to include("can't be blank")
|
352
|
+
|
353
|
+
end
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
it "価格が空では出品できない" do
|
358
|
+
|
359
|
+
item = FactoryBot.build(:item, price: "")
|
360
|
+
|
361
|
+
item.valid?
|
362
|
+
|
363
|
+
expect(item.errors[:price]).to include("can't be blank")
|
364
|
+
|
365
|
+
end
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
it "価格が数字でない場合(文字列の場合)は、出品できない" do
|
370
|
+
|
371
|
+
item = FactoryBot.build(:item, price: "aaaa")
|
372
|
+
|
373
|
+
item.valid?
|
374
|
+
|
375
|
+
expect(item.errors[:price]).to include("not a number")
|
376
|
+
|
377
|
+
end
|
258
378
|
|
259
379
|
end
|
260
380
|
|
261
|
-
describe "valid_create" do
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
it "画像、商品名、価格、商品説明、カテゴリー、商品状態、配送料の負担、発送元の地域、発送までの日数、が入力されていれば出品できる" do
|
266
|
-
|
267
|
-
item = build(:item)
|
268
|
-
|
269
|
-
expect(item).to be_valid
|
270
|
-
|
271
|
-
end
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
it "商品画像が空では出品できない" do
|
276
|
-
|
277
|
-
image = build(:image, image: "")
|
278
|
-
|
279
|
-
image.valid?
|
280
|
-
|
281
|
-
expect(image.error(:image)).to include("can`t be blank")
|
282
|
-
|
283
|
-
end
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
it "商品名が空では出品できない" do
|
288
|
-
|
289
|
-
item = build(:item, name: "")
|
290
|
-
|
291
|
-
item.valid?
|
292
|
-
|
293
|
-
expect(item.errors[:name]).to include("can't be blank")
|
294
|
-
|
295
|
-
end
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
it "商品説明が空では出品できない" do
|
300
|
-
|
301
|
-
item = build(:item, detail: "")
|
302
|
-
|
303
|
-
item.valid?
|
304
|
-
|
305
|
-
expect(item.errors[:detail]).to include("can't be blank")
|
306
|
-
|
307
|
-
end
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
it "カテゴリーが空では出品できない" do
|
312
|
-
|
313
|
-
item = build(:item, category_id: "")
|
314
|
-
|
315
|
-
item.valid?
|
316
|
-
|
317
|
-
expect(item.errors[:category_id]).to include("can't be blank")
|
318
|
-
|
319
|
-
end
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
it "商品の状態が空では出品できない" do
|
324
|
-
|
325
|
-
item = build(:item, state: "")
|
326
|
-
|
327
|
-
item.valid?
|
328
|
-
|
329
|
-
expect(item.errors[:state]).to include("can't be blank")
|
330
|
-
|
331
|
-
end
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
it "配送料の負担が空では出品できない" do
|
336
|
-
|
337
|
-
item = build(:item, delivery_fee: "")
|
338
|
-
|
339
|
-
item.valid?
|
340
|
-
|
341
|
-
expect(item.errors[:delivery_fee]).to include("can't be blank")
|
342
|
-
|
343
|
-
end
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
it "配送元の地域が空では出品できない" do
|
348
|
-
|
349
|
-
item = build(:item, city: "")
|
350
|
-
|
351
|
-
item.valid?
|
352
|
-
|
353
|
-
expect(item.errors[:city]).to include("can't be blank")
|
354
|
-
|
355
|
-
end
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
it "発送までの日数が空では出品できない" do
|
360
|
-
|
361
|
-
item = build(:item, delivery_days: "")
|
362
|
-
|
363
|
-
item.valid?
|
364
|
-
|
365
|
-
expect(item.errors[:delivery_days]).to include("can't be blank")
|
366
|
-
|
367
|
-
end
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
it "価格が空では出品できない" do
|
372
|
-
|
373
|
-
item = build(:item, price: "")
|
374
|
-
|
375
|
-
item.valid?
|
376
|
-
|
377
|
-
expect(item.errors[:price]).to include("can't be blank")
|
378
|
-
|
379
|
-
end
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
it "価格が数字でない場合(文字列の場合)は、出品できない" do
|
384
|
-
|
385
|
-
item = build(:item, price: "aaaa")
|
386
|
-
|
387
|
-
item.valid?
|
388
|
-
|
389
|
-
expect(item.errors[:price]).to include("not a number")
|
390
|
-
|
391
|
-
end
|
392
|
-
|
393
|
-
end
|
394
|
-
|
395
381
|
end
|
396
382
|
|
397
383
|
```
|
1
修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
RSpecのテスト bundle exec rspecを実行したらNoMethodError:が出てしまった
|
test
CHANGED
File without changes
|