summaryrefslogtreecommitdiff
path: root/spec/features/groups/issues_spec.rb
blob: 450bc0ff8cf95d23418c8a9e0c253931004aa83d (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
52
53
54
55
56
57
58
59
60
61
62
63
require 'spec_helper'

feature 'Group issues page' do
  include FilteredSearchHelpers

  context 'with shared examples' do
    let(:path) { issues_group_path(group) }
    let(:issuable) { create(:issue, project: project, title: "this is my created issuable")}

    include_examples 'project features apply to issuables', Issue

    context 'rss feed' do
      let(:access_level) { ProjectFeature::ENABLED }

      context 'when signed in' do
        let(:user) { user_in_group }

        it_behaves_like "it has an RSS button with current_user's RSS token"
        it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token"
      end

      context 'when signed out' do
        let(:user) { nil }

        it_behaves_like "it has an RSS button without an RSS token"
        it_behaves_like "an autodiscoverable RSS feed without an RSS token"
      end
    end

    context 'assignee', :js do
      let(:access_level) { ProjectFeature::ENABLED }
      let(:user) { user_in_group }
      let(:user2) { user_outside_group }
      let(:path) { issues_group_path(group) }

      it 'filters by only group users' do
        filtered_search.set('assignee:')

        expect(find('#js-dropdown-assignee .filter-dropdown')).to have_content(user.name)
        expect(find('#js-dropdown-assignee .filter-dropdown')).not_to have_content(user2.name)
      end
    end
  end

  context 'issues list', :nested_groups do
    let(:group) { create(:group)}
    let(:subgroup) { create(:group, parent: group) }
    let(:project) { create(:project, :public, group: group)}
    let(:subgroup_project) { create(:project, :public, group: subgroup)}
    let!(:issue) { create(:issue, project: project, title: 'root group issue') }
    let!(:subgroup_issue) { create(:issue, project: subgroup_project, title: 'subgroup issue') }

    it 'returns all group and subgroup issues' do
      visit issues_group_path(group)

      page.within('.issuable-list') do
        expect(page).to have_selector('li.issue', count: 2)
        expect(page).to have_content('root group issue')
        expect(page).to have_content('subgroup issue')
      end
    end
  end
end