質問編集履歴
1
fla,dfl,alf,;lad,f
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,89 +1 @@
|
|
1
|
-
Rspecについて
|
2
|
-
|
3
|
-
```
|
4
|
-
|
5
|
-
require 'rails_helper'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
RSpec.describe 'Tasks', type: :system do
|
10
|
-
|
11
|
-
let(:user) { create(:user) }
|
12
|
-
|
13
|
-
let(:task) { create(:task) }
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
describe 'ログイン後' do
|
18
|
-
|
19
|
-
before { login_as(user) }
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
describe 'タスク新規登録' do
|
24
|
-
|
25
|
-
context 'フォームの入力値が正常' do
|
26
|
-
|
27
|
-
it 'タスクの新規作成が成功する' do
|
28
|
-
|
29
|
-
visit new_task_path
|
30
|
-
|
31
|
-
fill_in 'Title', with: 'test_title'
|
32
|
-
|
33
|
-
fill_in 'Content', with: 'test_content'
|
34
|
-
|
35
|
-
select 'doing', from: 'Status'
|
36
|
-
|
37
|
-
fill_in 'Deadline', with: DateTime.new(2020, 6, 1, 10, 30)
|
38
|
-
|
39
|
-
click_button 'Create Task'
|
40
|
-
|
41
|
-
expect(page).to have_content 'Title: test_title'
|
42
|
-
|
43
|
-
expect(page).to have_content 'Content: test_content'
|
44
|
-
|
45
|
-
expect(page).to have_content 'Status: doing'
|
46
|
-
|
47
|
-
expect(page).to have_content 'Deadline: 2020/6/1 10:30'
|
48
|
-
|
49
|
-
|
1
|
+
laslfd,l;a,fsl;,al;,fl;da,;ls,fl;a,dl;f,al;fld,as;lf,das
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
context 'タイトルが未入力' do
|
58
|
-
|
59
|
-
it 'タスクの新規作成が失敗する' do
|
60
|
-
|
61
|
-
visit new_task_path
|
62
|
-
|
63
|
-
fill_in 'Title', with: ''
|
64
|
-
|
65
|
-
fill_in 'Content', with: 'test_content'
|
66
|
-
|
67
|
-
click_button 'Create Task'
|
68
|
-
|
69
|
-
expect(page).to have_content '1 error prohibited this task from being saved:'
|
70
|
-
|
71
|
-
expect(page).to have_content "Title can't be blank"
|
72
|
-
|
73
|
-
expect(current_path).to eq tasks_path
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
```
|
80
|
-
|
81
|
-
上で記述した↓のコードなのですが、
|
82
|
-
|
83
|
-
```
|
84
|
-
|
85
|
-
expect(page).to have_content "Title can't be blank"
|
86
|
-
|
87
|
-
```
|
88
|
-
|
89
|
-
have_content "Title can't be blank"の"Title can't be blank"の部分は任意で決められるものなのですか?
|