summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-15 11:29:36 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-15 11:29:36 +0000
commit7300729190f4e61c4e71f18d0a81ea044eaad98a (patch)
tree03cef3fbfd21712f1b19ea21c84ab62253940671 /spec/features
parent168d5eabd40f5767d1287fe194e57ed05ef5d990 (diff)
parent9eec51d914bc79fed479a4e3e7b86fda58ad77c8 (diff)
downloadgitlab-ce-7300729190f4e61c4e71f18d0a81ea044eaad98a.tar.gz
Merge branch 'rs-dev-issue-2228' into 'master'
Allow user to customize default Dashboard page Renames the "Design" profile page to "Preferences" and adds a field to customize the default Dashboard page: > ![Screen_Shot_2015-06-11_at_11.12.53_PM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/b5282a3be7861d1148528c6bc9e7a0e0/Screen_Shot_2015-06-11_at_11.12.53_PM.png) See merge request !778
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/profiles/preferences_spec.rb82
-rw-r--r--spec/features/security/profile_access_spec.rb4
2 files changed, 84 insertions, 2 deletions
diff --git a/spec/features/profiles/preferences_spec.rb b/spec/features/profiles/preferences_spec.rb
new file mode 100644
index 00000000000..69d15f41706
--- /dev/null
+++ b/spec/features/profiles/preferences_spec.rb
@@ -0,0 +1,82 @@
+require 'spec_helper'
+
+describe 'Profile > Preferences' do
+ let(:user) { create(:user) }
+
+ before do
+ login_as(user)
+ visit profile_preferences_path
+ end
+
+ describe 'User changes their application theme', js: true do
+ let(:default) { Gitlab::Themes.default }
+ let(:theme) { Gitlab::Themes.by_id(5) }
+
+ it 'creates a flash message' do
+ choose "user_theme_id_#{theme.id}"
+
+ expect_preferences_saved_message
+ end
+
+ it 'updates their preference' do
+ choose "user_theme_id_#{theme.id}"
+
+ allowing_for_delay do
+ visit page.current_path
+ expect(page).to have_checked_field("user_theme_id_#{theme.id}")
+ end
+ end
+
+ it 'reflects the changes immediately' do
+ expect(page).to have_selector("body.#{default.css_class}")
+
+ choose "user_theme_id_#{theme.id}"
+
+ expect(page).not_to have_selector("body.#{default.css_class}")
+ expect(page).to have_selector("body.#{theme.css_class}")
+ end
+ end
+
+ describe 'User changes their syntax highlighting theme', js: true do
+ it 'creates a flash message' do
+ choose 'user_color_scheme_id_5'
+
+ expect_preferences_saved_message
+ end
+
+ it 'updates their preference' do
+ choose 'user_color_scheme_id_5'
+
+ allowing_for_delay do
+ visit page.current_path
+ expect(page).to have_checked_field('user_color_scheme_id_5')
+ end
+ end
+ end
+
+ describe 'User changes their default dashboard' do
+ it 'creates a flash message' do
+ select 'Starred Projects', from: 'user_dashboard'
+ click_button 'Save'
+
+ expect_preferences_saved_message
+ end
+
+ it 'updates their preference' do
+ select 'Starred Projects', from: 'user_dashboard'
+ click_button 'Save'
+
+ click_link 'Dashboard'
+ expect(page.current_path).to eq starred_dashboard_projects_path
+
+ click_link 'Your Projects'
+ expect(page.current_path).to eq dashboard_path
+ end
+ end
+
+ def expect_preferences_saved_message
+ within('.flash-container') do
+ expect(page).to have_content('Preferences saved.')
+ end
+ end
+end
diff --git a/spec/features/security/profile_access_spec.rb b/spec/features/security/profile_access_spec.rb
index 2512a9c0e3d..2b09771851e 100644
--- a/spec/features/security/profile_access_spec.rb
+++ b/spec/features/security/profile_access_spec.rb
@@ -36,8 +36,8 @@ describe "Profile access", feature: true do
it { is_expected.to be_denied_for :visitor }
end
- describe "GET /profile/design" do
- subject { design_profile_path }
+ describe "GET /profile/preferences" do
+ subject { profile_preferences_path }
it { is_expected.to be_allowed_for @u1 }
it { is_expected.to be_allowed_for :admin }