prix-fixe

Expand History Expand History
Collapse History Collapse History

Render <form> element in notes#new template

This commit attempts to resolve the previous error:

Failure:
UserSharesAMessageTest#test_visiting_the_index [/Users/seanpdoyle/src/prix-fixe/test/system/user_shares_a_message_test.rb:12]:
expected to find text "Hello, World!" in "Message Share"

Our test’s assertion that the page contains the contents of our new note (i.e. "Hello, World!") fails.

The test makes this assertion by invoking assert_text. The failure message’s "Message Share" is derived by extracting the text out of our page’s <body>, ignoring HTML markup.

The change this commit includes (in an effort to advance our test to a new, different failure) aspires to submit the contents of the page’s <textarea> to our server. However, without a <form> element ancestor, our <textarea> does not have the means to submit its contents to our server.

This commit wraps the <textarea> and <button> in a <form> element that declares action="/notes" and method="post".

The combination of these two attributes results in the <form> element submitting a POST HTTP request to the application’s /notes path. The intention behind issuing a POST /notes request is to adhere to Rails’ REST-inspired routing convention.

When running the suite again, a new error is raised.

Error:
UserSharesAMessageTest#test_visiting_the_index:
ActionController::RoutingError: No route matches [POST] "/notes"