page.assert_no_selector '.editable-submit'
end
visit current_path
- # Raise exception if description update did not survive page refresh:
- find '.panel', text: 'I just edited this.'
+ assert(find?('.panel', text: 'I just edited this.'),
+ "Description update did not survive page refresh")
end
test 'Add a new name, then edit it, without creating a duplicate' do
q_string = URI.encode_www_form('api_token' => api_token)
"#{path}#{sep}#{q_string}"
end
+
+ # Find a page element, but return false instead of raising an
+ # exception if not found. Use this with assertions to explain that
+ # the error signifies a failed test rather than an unexpected error
+ # during a testing procedure.
+ def find? *args
+ begin
+ find *args
+ rescue Capybara::ElementNotFound
+ false
+ end
+ end
end