[openstreetmap/openstreetmap-website] Create a SessionsController (#3147)
Andy Allan
notifications at github.com
Wed Mar 24 14:10:39 UTC 2021
@gravitystorm commented on this pull request.
> + )
+ assert_recognizes(
+ { :controller => "sessions", :action => "destroy", :format => "html" },
+ { :path => "/logout.html", :method => :get }
+ )
+ end
+
+ def test_login
+ user = create(:user)
+
+ get login_path
+ assert_response :redirect
+ assert_redirected_to login_path(:cookie_test => true)
+ follow_redirect!
+ assert_response :success
+ assert_template "sessions/new"
This can go either way. The trouble with `assert_template "new"` is that it matches any template named `new` - it's not scoped to the controller under test. So if you end up rendering e.g. "users/new" somehow, the test will still pass.
So two choices:
* Keep as-is, to ensure we are rendering the sign-in form and not e.g. the user registration form.
* Remove the scoping, to be consistent with all our other tests, and accept that the risk is minimal.
I'm happy either way.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3147#discussion_r600512807
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20210324/4ef42447/attachment.htm>
More information about the rails-dev
mailing list