-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
common_actions.rb
62 lines (53 loc) · 1.79 KB
/
common_actions.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
Dir["./spec/support/common_actions/*.rb"].each { |f| require f }
module CommonActions
include Budgets
include Comments
include Debates
include Emails
include Notifications
include Polls
include Proposals
include RemoteCensusMock
include Tags
include Translations
include Users
include Verifications
include Votes
def app_host
"#{Capybara.app_host}:#{Capybara::Server.ports.values.last}"
end
def fill_in_signup_form(email = "[email protected]", password = "judgementday")
fill_in "user_username", with: "Manuela Carmena #{rand(99999)}"
fill_in "user_email", with: email
fill_in "user_password", with: password
fill_in "user_password_confirmation", with: password
check "user_terms_of_service"
end
def validate_officer
allow_any_instance_of(Officing::BaseController).
to receive(:verify_officer_assignment).and_return(true)
end
def fill_in_proposal
fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in_ckeditor "Proposal text", with: "This is very important because..."
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
end
def set_officing_booth(booth = nil)
booth = create(:poll_booth) if booth.blank?
allow_any_instance_of(Officing::BaseController).
to receive(:current_booth).and_return(booth)
end
def click_sdg_goal(code)
within(".sdg-related-list-selector .goals") do
find("[data-code='#{code}'] + label").click
end
end
def remove_sdg_goal_or_target_tag(code)
within "span[data-val='#{code}']" do
click_button "Remove"
end
end
end