BigW Consortium Gitlab

merge_requests_spec.rb 1.9 KB
Newer Older
1 2
require 'spec_helper'

3
feature 'Group merge requests page' do
4 5
  include FilteredSearchHelpers

6
  let(:path) { merge_requests_group_path(group) }
7
  let(:issuable) { create(:merge_request, source_project: project, target_project: project, title: 'this is my created issuable') }
8 9

  include_examples 'project features apply to issuables', MergeRequest
10 11

  context 'archived issuable' do
12
    let(:project_archived) { create(:project, :archived, :merge_requests_enabled, :repository, group: group) }
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
    let(:issuable_archived) { create(:merge_request, source_project: project_archived, target_project: project_archived, title: 'issuable of an archived project') }
    let(:access_level) { ProjectFeature::ENABLED }
    let(:user) { user_in_group }

    before do
      issuable_archived
      visit path
    end

    it 'hides archived merge requests' do
      expect(page).to have_content(issuable.title)
      expect(page).not_to have_content(issuable_archived.title)
    end

    it 'ignores archived merge request count badges in navbar' do
Phil Hughes committed
28
      expect(first(:link, text: 'Merge Requests').find('.badge').text).to eq("1")
29 30 31 32 33 34 35 36 37
    end

    it 'ignores archived merge request count badges in state-filters' do
      expect(page.find('#state-opened span.badge').text).to eq("1")
      expect(page.find('#state-merged span.badge').text).to eq("0")
      expect(page.find('#state-closed span.badge').text).to eq("0")
      expect(page.find('#state-all span.badge').text).to eq("1")
    end
  end
38 39 40 41 42 43 44 45 46 47 48 49 50

  context 'group filtered search', :js do
    let(:access_level) { ProjectFeature::ENABLED }
    let(:user) { user_in_group }
    let(:user2) { user_outside_group }

    it 'filters by assignee 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
51
end