Introduce NotesController tests
While the test suite is passing, there is an opportunity to drive improve the existing features and increase our system’s overall test coverage.
While implementing the project’s first feature, we didn’t
have a Note model, so we couldn’t interact with our system’s database.
To work within that constraint, our system accepted POST /notes HTTP
requests and responded with HTML that rendered the request body’s
content value.
Now that we’ve introduced a Note model and have a notes table in our
database, we can extend our existing behavior to also persist the
content submitted in POST /notes requests.
This commit introduces our first integration test to add test coverage
for our NotesController. The file contains a test to ensure
that the submitted data is persisted as a row in the notes table.
When we execute the new test, it raises a configuration error:
Error:
NotesControllerTest#test_#create_persists_a_Note_record:
DRb::DRbRemoteError: ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken)
test/controllers/notes_controller_test.rb|7| in `block in <class:NotesControllerTest>'