GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

preferences_spec.rb 1.46 KB
Newer Older
1 2
require 'spec_helper'

3
describe 'Profile > Preferences', :js do
4 5 6
  let(:user) { create(:user) }

  before do
7
    sign_in(user)
8
    visit profile_preferences_path
9 10
  end

11
  describe 'User changes their syntax highlighting theme' do
12 13 14
    it 'creates a flash message' do
      choose 'user_color_scheme_id_5'

15 16
      wait_for_requests

17 18 19 20 21 22
      expect_preferences_saved_message
    end

    it 'updates their preference' do
      choose 'user_color_scheme_id_5'

23 24 25 26
      wait_for_requests
      refresh

      expect(page).to have_checked_field('user_color_scheme_id_5')
27 28 29
    end
  end

30
  describe 'User changes their default dashboard' do
31 32 33 34
    it 'creates a flash message' do
      select 'Starred Projects', from: 'user_dashboard'
      click_button 'Save'

35 36
      wait_for_requests

37 38 39 40 41 42 43
      expect_preferences_saved_message
    end

    it 'updates their preference' do
      select 'Starred Projects', from: 'user_dashboard'
      click_button 'Save'

44 45 46
      wait_for_requests

      find('#logo').click
Phil Hughes's avatar
Phil Hughes committed
47

48 49
      expect(page).to have_content("You don't have starred projects yet")
      expect(page.current_path).to eq starred_dashboard_projects_path
50

Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
51
      find('.shortcuts-activity').trigger('click')
Phil Hughes's avatar
Phil Hughes committed
52

53
      expect(page).not_to have_content("You don't have starred projects yet")
Douwe Maan's avatar
Douwe Maan committed
54
      expect(page.current_path).to eq dashboard_projects_path
55 56 57 58
    end
  end

  def expect_preferences_saved_message
Robert Speicher's avatar
Robert Speicher committed
59
    page.within('.flash-container') do
60
      expect(page).to have_content('Preferences saved.')
61 62 63
    end
  end
end