2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
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
|
2019-02-20 22:58:53 +00:00
|
|
|
include Select2Helper
|
|
|
|
|
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
|
2019-08-14 21:12:38 +00:00
|
|
|
select2('stars', from: '#user_dashboard')
|
2015-06-10 21:08:10 +00:00
|
|
|
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
|
2019-08-14 21:12:38 +00:00
|
|
|
select2('stars', from: '#user_dashboard')
|
2015-06-10 21:08:10 +00:00
|
|
|
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
|
|
|
|
|
2019-02-20 22:58:53 +00:00
|
|
|
describe 'User changes their language', :js do
|
2019-04-09 10:04:03 +00:00
|
|
|
it 'creates a flash message', :quarantine do
|
2019-02-20 22:58:53 +00:00
|
|
|
select2('en', from: '#user_preferred_language')
|
|
|
|
click_button 'Save'
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
expect_preferences_saved_message
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates their preference' do
|
|
|
|
wait_for_requests
|
|
|
|
select2('eo', from: '#user_preferred_language')
|
|
|
|
click_button 'Save'
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
refresh
|
|
|
|
|
|
|
|
expect(page).to have_css('html[lang="eo"]')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-10 21:08:10 +00:00
|
|
|
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
|