Make `path`, `fill_resource_method_name`, `submit_button`, and `imageable_success_notice` dynamic based on the factory. Also adjusted the user. The proposals no longer require the user to be an administrator but do require them to be a level 2 user. Note that we are adding the Style/CaseLikeIf rubocop rule.
23 lines
653 B
Ruby
23 lines
653 B
Ruby
module Images
|
|
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 imageable_fill_new_valid_budget_investment
|
|
fill_in_new_investment_title with: "Budget investment title"
|
|
fill_in_ckeditor "Description", with: "Budget investment description"
|
|
check :budget_investment_terms_of_service
|
|
end
|
|
end
|