configuration_steps.rb
2.07 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
Given(/^I am at the All Configurations page$/) do
visit mezuro_configurations_path
end
Given(/^I am at the New Configuration page$/) do
visit new_mezuro_configuration_path
end
Given(/^I have a configuration named "(.*?)"$/) do |name|
@mezuro_configuration = FactoryGirl.create(:mezuro_configuration, {id: nil, name: name})
end
Given(/^I have a sample configuration$/) do
@mezuro_configuration = FactoryGirl.create(:mezuro_configuration, {id: nil})
end
Given(/^I own a sample configuration$/) do
@mezuro_configuration = FactoryGirl.create(:mezuro_configuration, {id: nil})
FactoryGirl.create(:mezuro_configuration_ownership, {id: nil, user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id})
end
Given(/^I am at the Sample Configuration page$/) do
visit mezuro_configuration_path(@mezuro_configuration.id)
end
Given(/^I am at the sample configuration edit page$/) do
visit edit_mezuro_configuration_path(@mezuro_configuration.id)
end
Given(/^I own a configuration named "(.*?)"$/) do |name|
@mezuro_configuration = FactoryGirl.create(:mezuro_configuration, {id: nil, name: name})
FactoryGirl.create(:mezuro_configuration_ownership, {id: nil, user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id})
end
When(/^I visit the sample configuration edit page$/) do
visit edit_mezuro_configuration_path(@mezuro_configuration.id)
end
Then(/^I should be in the Edit Configuration page$/) do
expect(page).to have_content("Edit Configuration")
end
Then(/^The field "(.*?)" should be filled with the sample configuration "(.*?)"$/) do |field, value|
expect(page.find_field(field).value).to eq(@mezuro_configuration.send(value))
end
Then(/^I should be in the All configurations page$/) do
expect(page).to have_content("Configurations")
end
Then(/^the sample configuration should not be there$/) do
expect { MezuroConfiguration.find(@mezuro_configuration.id) }.to raise_error
end
Then(/^the sample configuration should be there$/) do
expect(page).to have_content(@mezuro_configuration.name)
expect(page).to have_content(@mezuro_configuration.description)
end