prix-fixe

Expand History Expand History
Collapse History Collapse History

Link to "/"

This commit deviates from purely reactive, test-driven code changes.

The previous error was:

Error:
UserSharesAMessageTest#test_visiting_the_index:
Capybara::ElementNotFound: Unable to find field "Message"
    test/system/user_shares_a_message_test.rb:9:in `block in <class:UserSharesAMessageTest>'

The previous change to click_on "Share a Note" exercised an <a> element with an empty fragment (href="#"). When clicked, the browser does not navigate to a separate page.

If this change were motivated purely by test failures and error messages, we’d need to add an element to the notes#index page with "Message".

However, since the call to click_on "Share a Note" didn’t navigate to a new page, introducing a change that navigates to a “new” page shortens the path between our current behavior and our desired behavior.

Instead of rendering the text onto the current page, this commit replaces the <a href="#">...</a> with an <a> element that declares href="/notes/new".

When the system tests are run, our test suite raises a new error:

Error:
UserSharesAMessageTest#test_visiting_the_index:
AbstractController::ActionNotFound: The action 'new' could not be found for NotesController