summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-09-25 17:04:20 -0700
committerStan Hu <stanhu@gmail.com>2015-09-26 08:46:05 -0700
commit0383afc66ab889afc6af02203902d1d515723a96 (patch)
tree671139b4d862fa7c04ec5a1930dd3f8cf22dfefc /spec
parent6d6918105941bcb868b59350f56eb2f76efd7cf5 (diff)
downloadgitlab-ce-0383afc66ab889afc6af02203902d1d515723a96.tar.gz
Add user preference to view project activity and starred project activity as default dashboard
Closes #2662
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/root_controller_spec.rb24
-rw-r--r--spec/helpers/preferences_helper_spec.rb8
2 files changed, 29 insertions, 3 deletions
diff --git a/spec/controllers/root_controller_spec.rb b/spec/controllers/root_controller_spec.rb
index 64dfe8f34e3..5a104ae7c99 100644
--- a/spec/controllers/root_controller_spec.rb
+++ b/spec/controllers/root_controller_spec.rb
@@ -10,7 +10,7 @@ describe RootController do
allow(subject).to receive(:current_user).and_return(user)
end
- context 'who has customized their dashboard setting' do
+ context 'who has customized their dashboard setting for starred projects' do
before do
user.update_attribute(:dashboard, 'stars')
end
@@ -21,6 +21,28 @@ describe RootController do
end
end
+ context 'who has customized their dashboard setting for project activities' do
+ before do
+ user.update_attribute(:dashboard, 'project_activity')
+ end
+
+ it 'redirects to the activity list' do
+ get :index
+ expect(response).to redirect_to activity_dashboard_path
+ end
+ end
+
+ context 'who has customized their dashboard setting for starred project activities' do
+ before do
+ user.update_attribute(:dashboard, 'starred_project_activity')
+ end
+
+ it 'redirects to the activity list' do
+ get :index
+ expect(response).to redirect_to activity_dashboard_path(filter: 'starred')
+ end
+ end
+
context 'who uses the default dashboard setting' do
it 'renders the default dashboard' do
get :index
diff --git a/spec/helpers/preferences_helper_spec.rb b/spec/helpers/preferences_helper_spec.rb
index 06f69262b71..e5df59c4fba 100644
--- a/spec/helpers/preferences_helper_spec.rb
+++ b/spec/helpers/preferences_helper_spec.rb
@@ -8,14 +8,18 @@ describe PreferencesHelper do
end
it 'raises an exception when defined choices may be using the wrong key' do
- expect(User).to receive(:dashboards).and_return(foo: 'foo', bar: 'bar')
+ dashboards = User.dashboards.dup
+ dashboards[:projects_changed] = dashboards.delete :projects
+ expect(User).to receive(:dashboards).and_return(dashboards)
expect { helper.dashboard_choices }.to raise_error(KeyError)
end
it 'provides better option descriptions' do
expect(helper.dashboard_choices).to match_array [
['Your Projects (default)', 'projects'],
- ['Starred Projects', 'stars']
+ ['Starred Projects', 'stars'],
+ ["Your Projects' Activity", 'project_activity'],
+ ["Starred Projects' Activity", 'starred_project_activity']
]
end
end