summaryrefslogtreecommitdiff
path: root/spec/features/issues/user_sees_empty_state_spec.rb
blob: b43ba01606a4bba299b80d5bf3cf19df90028f18 (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
50
51
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Issues > User sees empty state', :js do
  let_it_be(:project) { create(:project, :public) }
  let_it_be(:user) { project.creator }

  shared_examples_for 'empty state with filters' do
    it 'user sees empty state with filters' do
      create(:issue, author: user, project: project)

      visit project_issues_path(project, milestone_title: "1.0")

      expect(page).to have_content('Sorry, your filter produced no results')
      expect(page).to have_content('To widen your search, change or remove filters above')
    end
  end

  describe 'while user is signed out' do
    describe 'empty state' do
      it 'user sees empty state' do
        visit project_issues_path(project)

        expect(page).to have_content('Register / Sign In')
        expect(page).to have_content('The Issue Tracker is the place to add things that need to be improved or solved in a project.')
        expect(page).to have_content('You can register or sign in to create issues for this project.')
      end

      it_behaves_like 'empty state with filters'
    end
  end

  describe 'while user is signed in' do
    before do
      sign_in(user)
    end

    describe 'empty state' do
      it 'user sees empty state' do
        visit project_issues_path(project)

        expect(page).to have_content('The Issue Tracker is the place to add things that need to be improved or solved in a project')
        expect(page).to have_content('Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.')
        expect(page).to have_content('New issue')
      end

      it_behaves_like 'empty state with filters'
    end
  end
end