project_steps.rb
2.22 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
73
74
75
76
77
78
79
80
81
require 'kalibro_client/errors'
Given(/^I am at the All Projects page$/) do
visit projects_path
end
Given(/^I have a sample project$/) do
@project = FactoryGirl.create(:project)
end
Given(/^I have sample project_attributes$/) do
@project_attributes = FactoryGirl.create(:project_attributes, {id: nil, user_id: @user.id})
end
Given(/^I have a project named "(.*?)"$/) do |name|
@project = FactoryGirl.create(:project, {name: name})
end
Given(/^I own a sample project$/) do
@project = FactoryGirl.create(:project)
FactoryGirl.create(:project_attributes, {user_id: @user.id, project_id: @project.id})
end
Given(/^I own a project named "(.*?)"$/) do |name|
@project = FactoryGirl.create(:project, {name: name})
FactoryGirl.create(:project_attributes, {user_id: @user.id, project_id: @project.id})
end
Given(/^I am at the Sample Project page$/) do
visit project_path(id: @project.id)
end
Given(/^I am at the sample project edit page$/) do
visit edit_project_path(id: @project.id)
end
Given(/^I visit the sample project edit page$/) do
visit edit_project_path(id: @project.id)
end
Given(/^I am at the New Project page$/) do
visit new_project_path
end
Then(/^I should not see "(.+)"$/) do |text|
expect(page).to_not have_content(text)
end
Then(/^I should not see (.+) within (.+)$/) do |text, selector|
expect(page.find(selector)).to_not have_content(text)
end
Then(/^the sample project should be there$/) do
expect(page).to have_content(@project.name)
expect(page).to have_content(@project.description)
end
Then(/^I should be in the All Projects page$/) do
expect(page).to have_content("Projects")
end
Then(/^I should be in the Edit Project page$/) do
expect(page).to have_content("Edit Project")
end
Then(/^I should be in the Sample Project page$/) do
expect(page).to have_content(@project.name)
expect(page).to have_content(@project.description)
end
Then(/^I should be in the Login page$/) do
expect(page).to have_content("Sign in")
end
Then(/^the sample project should not be there$/) do
expect { Project.find(@project.id) }.to raise_error
end
Then(/^The field "(.*?)" should be filled with the sample project "(.*?)"$/) do |field, value|
expect(page.find_field(field).value).to eq(@project.send(value))
end