diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-01-23 16:08:15 -0800 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-01-23 16:10:13 -0800 |
commit | a7c4d0da8c7a340efd7b92718cd0f9436f2ec56f (patch) | |
tree | 7816d8eef06f84c5f8f7e12e998adf58b7692085 /spec | |
parent | 5409fc49bd7fb1e24f048ec5b8931b216b6ceda8 (diff) | |
download | gitlab-ce-a7c4d0da8c7a340efd7b92718cd0f9436f2ec56f.tar.gz |
Make the `/groups` route behave as expectedrs-groups-index
The route is supposed to redirect the Groups#index request based on
whether or not a user was logged in. If they are, we redirect them to
their groups dashboard; if they're not, we redirect them to the public
Explore page.
But due to overly aggressive `before_action`s that weren't excluding the
`index` action, the request always resulted in a 404, whether a user was
logged in or not.
Closes #12660
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/groups_controller_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb new file mode 100644 index 00000000000..938e97298b6 --- /dev/null +++ b/spec/controllers/groups_controller_spec.rb @@ -0,0 +1,23 @@ +require 'rails_helper' + +describe GroupsController do + describe 'GET index' do + context 'as a user' do + it 'redirects to Groups Dashboard' do + sign_in(create(:user)) + + get :index + + expect(response).to redirect_to(dashboard_groups_path) + end + end + + context 'as a guest' do + it 'redirects to Explore Groups' do + get :index + + expect(response).to redirect_to(explore_groups_path) + end + end + end +end |