diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-27 03:08:49 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-27 03:08:49 +0000 |
commit | 996c6bf06f602ada62e3f754c121c17051072892 (patch) | |
tree | c7568793468de0faef693795e00f34c07da8e793 /spec/graphql | |
parent | 0a0e82d1440b06650e5fc524168b1f50a8feec68 (diff) | |
download | gitlab-ce-996c6bf06f602ada62e3f754c121c17051072892.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql')
-rw-r--r-- | spec/graphql/resolvers/issues_resolver_spec.rb | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/spec/graphql/resolvers/issues_resolver_spec.rb b/spec/graphql/resolvers/issues_resolver_spec.rb index 3fbb7280465..7cfef9b4cc7 100644 --- a/spec/graphql/resolvers/issues_resolver_spec.rb +++ b/spec/graphql/resolvers/issues_resolver_spec.rb @@ -8,11 +8,13 @@ describe Resolvers::IssuesResolver do let(:current_user) { create(:user) } context "with a project" do - let_it_be(:project) { create(:project) } - let_it_be(:issue1) { create(:issue, project: project, state: :opened, created_at: 3.hours.ago, updated_at: 3.hours.ago) } - let_it_be(:issue2) { create(:issue, project: project, state: :closed, title: 'foo', created_at: 1.hour.ago, updated_at: 1.hour.ago, closed_at: 1.hour.ago) } - let_it_be(:label1) { create(:label, project: project) } - let_it_be(:label2) { create(:label, project: project) } + let_it_be(:project) { create(:project) } + let_it_be(:milestone) { create(:milestone, project: project) } + let_it_be(:assignee) { create(:user) } + let_it_be(:issue1) { create(:issue, project: project, state: :opened, created_at: 3.hours.ago, updated_at: 3.hours.ago, milestone: milestone) } + let_it_be(:issue2) { create(:issue, project: project, state: :closed, title: 'foo', created_at: 1.hour.ago, updated_at: 1.hour.ago, closed_at: 1.hour.ago, assignees: [assignee]) } + let_it_be(:label1) { create(:label, project: project) } + let_it_be(:label2) { create(:label, project: project) } before do project.add_developer(current_user) @@ -31,6 +33,26 @@ describe Resolvers::IssuesResolver do expect(resolve_issues(state: 'closed')).to contain_exactly(issue2) end + it 'filters by milestone' do + expect(resolve_issues(milestone_title: milestone.title)).to contain_exactly(issue1) + end + + it 'filters by assignee_username' do + expect(resolve_issues(assignee_username: assignee.username)).to contain_exactly(issue2) + end + + it 'filters by assignee_id' do + expect(resolve_issues(assignee_id: assignee.id)).to contain_exactly(issue2) + end + + it 'filters by any assignee' do + expect(resolve_issues(assignee_id: IssuableFinder::FILTER_ANY)).to contain_exactly(issue2) + end + + it 'filters by no assignee' do + expect(resolve_issues(assignee_id: IssuableFinder::FILTER_NONE)).to contain_exactly(issue1) + end + it 'filters by labels' do expect(resolve_issues(label_name: [label1.title])).to contain_exactly(issue1, issue2) expect(resolve_issues(label_name: [label1.title, label2.title])).to contain_exactly(issue2) |