gitlab-org--gitlab-foss/spec/controllers/groups_controller_spec.rb
Robert Speicher a7c4d0da8c Make the /groups route behave as expected
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
2016-01-23 16:10:13 -08:00

23 lines
463 B
Ruby

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