2015-06-05 17:57:01 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-12 22:50:18 +00:00
|
|
|
describe 'User visits the profile preferences page' do
|
2015-06-05 17:57:01 +00:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in(user)
|
2017-09-12 22:50:18 +00:00
|
|
|
|
|
|
|
visit(profile_preferences_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows correct menu item' do
|
2017-09-16 10:09:58 +00:00
|
|
|
expect(page).to have_active_navigation('Preferences')
|
2015-06-05 17:57:01 +00:00
|
|
|
end
|
|
|
|
|
2017-09-12 22:50:18 +00:00
|
|
|
describe 'User changes their syntax highlighting theme', :js do
|
2015-06-10 21:08:10 +00:00
|
|
|
it 'creates a flash message' do
|
|
|
|
choose 'user_color_scheme_id_5'
|
|
|
|
|
2017-08-08 14:45:52 +00:00
|
|
|
wait_for_requests
|
|
|
|
|
2015-06-10 21:08:10 +00:00
|
|
|
expect_preferences_saved_message
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates their preference' do
|
|
|
|
choose 'user_color_scheme_id_5'
|
|
|
|
|
2017-08-08 14:45:52 +00:00
|
|
|
wait_for_requests
|
|
|
|
refresh
|
|
|
|
|
|
|
|
expect(page).to have_checked_field('user_color_scheme_id_5')
|
2015-06-10 21:08:10 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-09-12 22:50:18 +00:00
|
|
|
describe 'User changes their default dashboard', :js do
|
2015-06-10 21:08:10 +00:00
|
|
|
it 'creates a flash message' do
|
|
|
|
select 'Starred Projects', from: 'user_dashboard'
|
|
|
|
click_button 'Save'
|
|
|
|
|
2017-08-08 14:45:52 +00:00
|
|
|
wait_for_requests
|
|
|
|
|
2015-06-10 21:08:10 +00:00
|
|
|
expect_preferences_saved_message
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates their preference' do
|
|
|
|
select 'Starred Projects', from: 'user_dashboard'
|
|
|
|
click_button 'Save'
|
|
|
|
|
2017-08-08 14:45:52 +00:00
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
find('#logo').click
|
2016-08-11 16:48:32 +00:00
|
|
|
|
2017-08-08 14:45:52 +00:00
|
|
|
expect(page).to have_content("You don't have starred projects yet")
|
|
|
|
expect(page.current_path).to eq starred_dashboard_projects_path
|
2015-06-10 21:08:10 +00:00
|
|
|
|
2017-06-17 06:08:27 +00:00
|
|
|
find('.shortcuts-activity').click
|
2016-08-11 16:48:32 +00:00
|
|
|
|
2016-08-12 17:44:43 +00:00
|
|
|
expect(page).not_to have_content("You don't have starred projects yet")
|
2015-09-08 16:14:02 +00:00
|
|
|
expect(page.current_path).to eq dashboard_projects_path
|
2015-06-10 21:08:10 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def expect_preferences_saved_message
|
2015-06-19 02:13:32 +00:00
|
|
|
page.within('.flash-container') do
|
2015-06-10 21:08:10 +00:00
|
|
|
expect(page).to have_content('Preferences saved.')
|
2015-06-05 17:57:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|