debian-mirror-gitlab/spec/graphql/resolvers/project_pipelines_resolver_spec.rb

34 lines
849 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Resolvers::ProjectPipelinesResolver do
2018-11-08 19:23:39 +05:30
include GraphqlHelpers
2020-04-08 14:13:33 +05:30
let_it_be(:project) { create(:project) }
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
let_it_be(:other_pipeline) { create(:ci_pipeline) }
2021-06-08 01:23:25 +05:30
2018-11-08 19:23:39 +05:30
let(:current_user) { create(:user) }
2021-11-18 22:05:49 +05:30
context 'when the user does have access' do
before do
project.add_developer(current_user)
end
it 'resolves only MRs for the passed merge request' do
expect(resolve_pipelines).to contain_exactly(pipeline)
end
2018-11-08 19:23:39 +05:30
end
2021-11-18 22:05:49 +05:30
context 'when the user does not have access' do
it 'does not return pipeline data' do
expect(resolve_pipelines).to be_empty
end
2018-11-08 19:23:39 +05:30
end
2021-11-18 22:05:49 +05:30
def resolve_pipelines
resolve(described_class, obj: project, ctx: { current_user: current_user })
2018-11-08 19:23:39 +05:30
end
end