Welcome to mirror list, hosted at ThFree Co, Russian Federation.

error_pages_spec.rb « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6a322fd53d4c859c9f1118d484c1b62f35dff73f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Error Pages', :js, feature_category: :error_tracking do
  let(:user) { create(:user) }
  let(:project) { create(:project, :public) }

  before do
    sign_in(user)
  end

  shared_examples 'shows nav links' do
    it 'shows nav links' do
      expect(page).to have_link("Home", href: root_path)
      expect(page).to have_link("Help", href: help_path)
    end

    it 'allows user to sign out' do
      click_link 'Sign out and sign in with a different account'

      expect(page).to have_current_path(new_user_session_path)
    end
  end

  describe '404' do
    before do
      visit '/not-a-real-page'
    end

    it 'allows user to search' do
      fill_in 'search', with: 'something'
      click_button 'Search'

      expect(page).to have_current_path(%r{^/search\?.*search=something.*})
    end

    it_behaves_like 'shows nav links'
  end

  describe '403' do
    before do
      visit '/'
      visit edit_project_path(project)
    end

    it_behaves_like 'shows nav links'
  end
end