edit
and update
actionsLimericksController#edit
and LimericksController#update
methods function correctly for the happy path.LimericksController#edit
test/controllers/limericks_controller_test.rb
"should get edit"
User
fixture object one
.edit_limerick_url
(with the retrieved limerick as an argument)assert_response
to check that the response has a success status code (e.g., 200 OK
).assert_select
to check that the rendered page has an h1
HTML element with the text “Edit Limerick”.LimericksController#update
test/controllers/limericks_controller_test.rb
"should update limerick"
User
fixture object one
.limerick_url
(with the retrieved limerick as an argument)limerick: {
title: 'There was an odd fellow named Gus',
limerick_text: "There was an odd fellow named Gus,\nWhen traveling he made such a fuss.\nHe was banned from the train,\nNot allowed on a plane,\nAnd now travels only by bus."
}
assert_no_difference
to check that the number of Limerick
objects in the database has not changed.assert_response
to check that the HTTP response has a redirect status code.assert_redirected_to
to check that the HTTP redirect was to the root URL.assert_not_nil
to check that a flash['success']
message was set.edit
and update
controller tests submit screenshots that includes:
rails test -v
showing that the controller tests ran and passed.