mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
Support for /my/preferences to automatically redirect to the logged in
user.
This commit is contained in:
@ -1323,4 +1323,27 @@ describe UsersController do
|
||||
end
|
||||
end
|
||||
|
||||
describe '.my_redirect' do
|
||||
|
||||
it "returns 404 if the user is not logged in" do
|
||||
get :my_redirect, path: "wat"
|
||||
response.should_not be_success
|
||||
response.should_not be_redirect
|
||||
end
|
||||
|
||||
context "when the user is logged in" do
|
||||
let!(:user) { log_in }
|
||||
|
||||
it "will not redirect to an invalid path" do
|
||||
get :my_redirect, path: "wat/..password.txt"
|
||||
response.should_not be_redirect
|
||||
end
|
||||
|
||||
it "will redirect to an valid path" do
|
||||
get :my_redirect, path: "preferences"
|
||||
response.should be_redirect
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user