step %{I save a task without the required fields} do
within_task_form do
# NOTE filling with '' won't work as it does not trigger keypress events
# and thus breaks angular bindings
fill_in 'task_name', with: ' '
end
step %{I save the task}
end
step %{the task should be :task_state} do |task_state|
within '.tag-list .dropdown.task-state' do
expect(page).to have_css '.dropdown-toggle', text: task_state.capitalize
toggle_dropdown # NOTE needed to get next assertion, else finder returns '' for some reason
expect(page).to have_css '.dropdown-menu .active', text: task_state.capitalize
end
end
step %{I go to edit task} do
expect(page).to have_css %{a[rel='edit-task']}, visible: true
find(%{a[rel='edit-task']}).click
# NOTE must wait for selector else turbolinks breaks the next step since it
# will execute instantly as it is no longer waiting for the traditional page load
expect(page).to have_css '.editor-pane'
end