-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpath_spec.rb
More file actions
72 lines (61 loc) · 1.75 KB
/
Copy pathpath_spec.rb
File metadata and controls
72 lines (61 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# frozen_string_literal: true
require 'rails_helper'
describe 'Index Page Path' do
it 'visit index' do
visit ad_index_path
expect(current_path).to eq ad_index_path
end
end
describe 'Creation of New Ad' do
before do
visit new_ad_path
end
it 'is Forms valid?' do
fill_in 'ad_text', with: 'TextForm'
fill_in 'ad_price', with: '1000'
fill_in 'ad_text', with: 'TextForm'
page.attach_file('ad_image', '/Users/hashimototakuma/Downloads/PNG_transparency_demonstration_1.png')
end
it 'is create action valid?' do
fill_in 'ad_text', with: 'TextForm'
fill_in 'ad_price', with: '1000'
fill_in 'ad_text', with: 'TextForm'
page.attach_file('ad_image', '/Users/hashimototakuma/Downloads/PNG_transparency_demonstration_1.png')
expect { click_button '入稿' }.to change { Ad.count }.by(1)
end
end
describe 'Index Links' do
before do
visit ad_index_path
end
it 'now on index?' do
expect(current_path).to eq ad_index_path
end
it 'new valid?' do
click_link('New')
expect(current_path).to eq new_ad_path
end
end
describe 'Buttons' do
context 'after new ad created' do
before do
visit 'ad/new'
fill_in 'ad_text', with: 'TextForm'
fill_in 'ad_price', with: '1000'
fill_in 'ad_text', with: 'TextForm'
page.attach_file('ad_image', '/Users/hashimototakuma/Downloads/PNG_transparency_demonstration_1.png')
click_button '入稿'
end
it 'should be on index page' do
expect(current_path).to eq ad_index_path
end
context 'on Index Page' do
it 'edit clickable' do
click_link('Edit')
end
it 'Delete clickable and its action workable' do
expect { click_link 'Delete' }.to change { Ad.count }.by(-1)
end
end
end
end