Commit Graph

6 Commits

Author SHA1 Message Date
Javi Martín
4fc4afa3a7 Add RSpec/ExcessiveDocstringSpacing rubocop rule
This rule was added in rubocop-rspec 2.5.0.
2023-09-06 19:00:56 +02:00
Iraline
0195eac3fa change the code to use what Devise does by default and update the tests 2022-05-09 18:14:12 -03:00
Iraline
985ab4faad Tests to validate the flow of token already used 2022-04-27 12:04:16 -03:00
Javi Martín
91c21b0982 Remove instance variables in RSpec
Instance variables might lead to hard-to-detect issues, since using a
nonexistent instance variable will return `nil` instead of raising an
error.
2019-09-30 16:43:10 +02:00
Julian Herrero
bb25da2572 Remove Rspec deprecation warning
DEPRECATION WARNING: Using positional arguments in functional tests
has been deprecated, in favor of keyword arguments, and will be
removed in Rails 5.1.

Deprecated style:
get :show, { id: 1 }, nil, { notice: "Flash message" }

New keyword style:
get :show, params: { id: 1 }, flash: { notice: "Flash message" }
2019-05-23 13:19:45 +02:00
Javi Martín
78c6395e5f Respond with 404 when confirming an invalid token
We were getting a 500 Internal Server Error because `find_by` returned
`nil`, but the code assumed it returned an object responding to
`encrypted_password`. In this case, maybe some other status code (like
400 or 401) might be more appropriate, but I've kept 404 because it was
easier to implement and I wasn't sure which one was better.

Also note ideally we would test the controller using:

expect(response).to have_http_status(:not_found)

However, we would need to configure the test to show exceptions and not
to consider all requests local. I haven't been able to do so for
controller tests, and doing so for feature/request specs seems to
require changes in the test environment configuration which would affect
other tests.
2019-04-10 12:41:21 +02:00