Change method to Cucumber step

This commit is contained in:
Urban Rotnik 2020-07-09 11:43:00 +02:00
parent 8432db26a4
commit 6cddcc2ea2
2 changed files with 4 additions and 7 deletions

View file

@ -1,21 +1,22 @@
# Tasks # Tasks
def visit_task_page(task_name) # /modules/:id/ Given("I'm on the Protocols page of a {string} task") do |task_name|
m = MyModule.find_by(name: task_name) m = MyModule.find_by(name: task_name)
visit protocols_my_module_path(m) visit protocols_my_module_path(m)
end end
def visit_task_results_page(task_name) # /modules/:id/results Given("I'm on the Protocols result page of a {string} task") do |task_name|
m = MyModule.find_by(name: task_name) m = MyModule.find_by(name: task_name)
visit results_my_module_path(m) visit results_my_module_path(m)
end end
def visit_task_archived_results_page(task_name) # /modules/:id/archive Given("I'm on the Protocols result archived page of a {string} task") do |task_name|
m = MyModule.find_by(name: task_name) m = MyModule.find_by(name: task_name)
visit archive_my_module_path(m) visit archive_my_module_path(m)
end end
# Change methods to steps
# Settings # Settings
def visit_profile_page def visit_profile_page
visit edit_user_registration_path visit edit_user_registration_path

View file

@ -1,9 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
Given("I'm on the Protocols page of a {string} task") do |task_name|
visit_task_page(task_name)
end
Then(/^I should see "([^"]*)" attachment on "([^"]*)" step$/) do |file, step_name| Then(/^I should see "([^"]*)" attachment on "([^"]*)" step$/) do |file, step_name|
wait_for_ajax wait_for_ajax
expect(find('.step', text: step_name)).to have_content(file) expect(find('.step', text: step_name)).to have_content(file)