-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_contract_spec.rb
62 lines (50 loc) · 1.36 KB
/
create_contract_spec.rb
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
require 'spec_helper'
feature "Create a contract", :admin, :ui, :nightly do
given(:contract_name) {"My really special contract"}
given(:org_name) {"Special org"}
def remove_contract(name)
login_as_admin
visit 'contracts'
# delete the contract, if I can
click_link contract_name
page.accept_alert do
click_button 'Delete Contract'
end
rescue
# Don't care if it fails
end
after do
remove_contract contract_name
end
Steps "works" do
Given 'I am logged in as an admin' do
login_as_admin
end
Given 'I am on the new contracts page' do
# Click the Admin link
find('#account').hover
within('#account') do
click_link 'Admin'
end
within('.menu') do
click_link 'Contract'
end
click_link 'create contract'
end
When 'I enter invalid information' do
click_button 'Save Contract'
end
Then 'I should see validation errors' do
expect(page).to have_content "Name is too short"
expect(page).to have_content "Organization is too short"
end
When 'I enter valid information' do
fill_in 'Contract Name', with: contract_name
fill_in 'Organization', with: org_name
click_button 'Save Contract'
end
Then 'the contract is created' do
expect(page).to have_content contract_name
end
end
end