Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-06-10 10:59:39 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-06-14 00:59:11 +0300
commit94d3c1433df9380ca83f1f35a540074ff0690410 (patch)
tree98da5a0832c587199b848af871e499a8980c4bf7 /spec/controllers/root_controller_spec.rb
parent2bc4fd2d047c1c4c4637f045ed3a51d414359c2a (diff)
Add RootController
This controller is now the target for `root_url`. It sub-classes DashboardController so we can render the old default without a redirect if the user hasn't customized their dashboard location.
Diffstat (limited to 'spec/controllers/root_controller_spec.rb')
-rw-r--r--spec/controllers/root_controller_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/controllers/root_controller_spec.rb b/spec/controllers/root_controller_spec.rb
new file mode 100644
index 00000000000..abbbf6855fc
--- /dev/null
+++ b/spec/controllers/root_controller_spec.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+describe RootController do
+ describe 'GET show' do
+ context 'with a user' do
+ let(:user) { create(:user) }
+
+ before do
+ sign_in(user)
+ allow(subject).to receive(:current_user).and_return(user)
+ end
+
+ context 'who has customized their dashboard setting' do
+ before do
+ user.update_attribute(:dashboard, 'stars')
+ end
+
+ it 'redirects to their specified dashboard' do
+ get :show
+ expect(response).to redirect_to starred_dashboard_projects_path
+ end
+ end
+
+ context 'who uses the default dashboard setting' do
+ it 'renders the default dashboard' do
+ get :show
+ expect(response).to render_template 'dashboard/show'
+ end
+ end
+ end
+ end
+end