prix-fixe

Expand History Expand History
Collapse History Collapse History

Render content from params

This commit responds to the previous error message:

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 ""

In an effort to render the test’s "Hello, World!" String in the response body, this commit attempts to fetch it from [NoteController#params`]params.

The params value makes incoming request values available through a Hash-like interface.

In a previous commit, we declared a <form> element with a <textarea> element meant to represent a new Note’s content. This commit attempts to retrieve that value by invoking params.fetch(:content). The use of #fetch instead of #[] is intentional, since creating a new Note will require a content value.

When we run the test again, it raises a new error:

Error:
UserSharesAMessageTest#test_visiting_the_index:
ActionView::Template::Error: param is missing or the value is empty: content
    app/views/notes/create.html.erb:1