I am running through the Hartl Rails Tutorial and have completed the exercises in 9.60, 9.61, 9.62 that call for refactoring of the new and edit form code with a new partial. The forms now use 'provide' to supply button text as in:
<% provide(:button_text, 'Create my account') %>
Which is rendered on the page with 'yield' as in:
<%= f.submit yield(:button_text), class: "btn btn-primary" %>
While not part of the exercise, I am not trying to write an integration test that will test for the correct text on the button for each page. For example this code will test the sign up form page:
test "signup page" do
get signup_path
assert_select "title", full_title("Sign up")
assert_select "input[type=submit]", value: "Create my account"
end
However I have not been able to figure out the correct code for selecting the button and specifying the correct value for the button text. I have made the button text incorrect to try to get the test to fail, but have not found the correct test syntax that succeeds at failing ;-)
Documentation for ActionDispatch did not have a specific example that was helpful for this test case.