2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe 'User visits the profile preferences page' do
|
2019-07-07 11:18:12 +05:30
|
|
|
include Select2Helper
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
visit(profile_preferences_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows correct menu item' do
|
|
|
|
expect(page).to have_active_navigation('Preferences')
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe 'User changes their syntax highlighting theme', :js do
|
2015-09-11 14:41:01 +05:30
|
|
|
it 'creates a flash message' do
|
|
|
|
choose 'user_color_scheme_id_5'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
expect_preferences_saved_message
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates their preference' do
|
|
|
|
choose 'user_color_scheme_id_5'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
|
|
|
refresh
|
|
|
|
|
|
|
|
expect(page).to have_checked_field('user_color_scheme_id_5')
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe 'User changes their default dashboard', :js do
|
2015-09-11 14:41:01 +05:30
|
|
|
it 'creates a flash message' do
|
2019-10-12 21:52:04 +05:30
|
|
|
select2('stars', from: '#user_dashboard')
|
2015-09-11 14:41:01 +05:30
|
|
|
click_button 'Save'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
expect_preferences_saved_message
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates their preference' do
|
2019-10-12 21:52:04 +05:30
|
|
|
select2('stars', from: '#user_dashboard')
|
2015-09-11 14:41:01 +05:30
|
|
|
click_button 'Save'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
find('#logo').click
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content("You don't have starred projects yet")
|
|
|
|
expect(page.current_path).to eq starred_dashboard_projects_path
|
2015-09-11 14:41:01 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
find('.shortcuts-activity').click
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_content("You don't have starred projects yet")
|
2015-09-25 12:07:36 +05:30
|
|
|
expect(page.current_path).to eq dashboard_projects_path
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
describe 'User changes their language', :js do
|
2019-07-31 22:56:46 +05:30
|
|
|
it 'creates a flash message', :quarantine do
|
2019-07-07 11:18:12 +05:30
|
|
|
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-09-11 14:41:01 +05:30
|
|
|
def expect_preferences_saved_message
|
|
|
|
page.within('.flash-container') do
|
|
|
|
expect(page).to have_content('Preferences saved.')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|