diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-06-10 17:08:10 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-06-13 17:59:12 -0400 |
commit | bf9dd4327e36b6ab0b5440dcff747fff27aa5c22 (patch) | |
tree | b158cabcc9d8862200e73bf5c3337a2489a3b1fa /spec | |
parent | 1eb9a02f21d45f2fa301576723bbb0a23b5ba22d (diff) | |
download | gitlab-ce-bf9dd4327e36b6ab0b5440dcff747fff27aa5c22.tar.gz |
Add feature specs for default dashboard preference
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/profiles/preferences_spec.rb | 57 |
1 files changed, 48 insertions, 9 deletions
diff --git a/spec/features/profiles/preferences_spec.rb b/spec/features/profiles/preferences_spec.rb index a946064a877..1f07fde7afc 100644 --- a/spec/features/profiles/preferences_spec.rb +++ b/spec/features/profiles/preferences_spec.rb @@ -5,22 +5,25 @@ describe 'Profile > Preferences' do 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) } - before do - visit profile_preferences_path + it 'creates a flash message' do + choose "user_theme_id_#{theme.id}" + + expect_preferences_saved_message end - it 'creates a flash message' do + it 'updates their preference' do choose "user_theme_id_#{theme.id}" - within('.flash-container') do - expect(page).to have_content('Preferences saved.') - end + visit page.current_path + + expect(page).to have_checked_field("user_theme_id_#{theme.id}") end it 'reflects the changes immediately' do @@ -33,9 +36,45 @@ describe 'Profile > Preferences' do end end - describe 'User changes their syntax highlighting theme' do - before do - visit profile_preferences_path + 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' + + visit page.current_path + + expect(page).to have_checked_field('user_color_scheme_id_5') + 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 |