summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-01-26 11:59:05 +0000
committerDouwe Maan <douwe@gitlab.com>2016-01-26 11:59:05 +0000
commit28e2d2142c2085981d16d49a6b97b85996b08a55 (patch)
treee89bb4f88a14bd53b9b84de9371d6232a8794c9e /spec/controllers
parenteb7f669073b2b95a1956de5e22f97dc8f83711e8 (diff)
parenta7c4d0da8c7a340efd7b92718cd0f9436f2ec56f (diff)
downloadgitlab-ce-28e2d2142c2085981d16d49a6b97b85996b08a55.tar.gz
Merge branch 'rs-groups-index' into 'master'
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 (or including) the `index` action, the request always resulted in a 404, whether a user was logged in or not. Closes #12660 See merge request !2580
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/groups_controller_spec.rb23
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