Replaced the user with a level_two one in the "Default whole city" test to bypass the full name requirement, which only applies to unverified users.
55 lines
1.3 KiB
Ruby
55 lines
1.3 KiB
Ruby
module Attachables
|
|
def imageable_attach_new_file(path, success: true)
|
|
click_link "Add image"
|
|
within "#nested-image" do
|
|
image = find(".image-fields")
|
|
attach_file "Choose image", path
|
|
within image do
|
|
if success
|
|
expect(page).to have_css(".loading-bar.complete")
|
|
else
|
|
expect(page).to have_css(".loading-bar.errors")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
def documentable_attach_new_file(path, success: true)
|
|
click_link "Add new document"
|
|
|
|
document = all(".document-fields").last
|
|
attach_file "Choose document", path
|
|
|
|
within document do
|
|
if success
|
|
expect(page).to have_css ".loading-bar.complete"
|
|
else
|
|
expect(page).to have_css ".loading-bar.errors"
|
|
end
|
|
end
|
|
end
|
|
|
|
def admin_section?(path)
|
|
path.starts_with?("/admin/")
|
|
end
|
|
|
|
def management_section?(path)
|
|
path.starts_with?("/management/")
|
|
end
|
|
|
|
def edit_path?(path)
|
|
path.ends_with?("/edit")
|
|
end
|
|
|
|
def fill_in_required_fields(factory, path)
|
|
return if edit_path?(path)
|
|
|
|
case factory
|
|
when :budget then fill_in_budget
|
|
when :budget_investment then fill_in_budget_investment
|
|
when :dashboard_action then fill_in_dashboard_action
|
|
when :proposal then fill_in_proposal
|
|
end
|
|
end
|
|
end
|