diff options
Diffstat (limited to 'spec/finders/pipelines_finder_spec.rb')
-rw-r--r-- | spec/finders/pipelines_finder_spec.rb | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/spec/finders/pipelines_finder_spec.rb b/spec/finders/pipelines_finder_spec.rb index d6253b605b9..c6e832ad69b 100644 --- a/spec/finders/pipelines_finder_spec.rb +++ b/spec/finders/pipelines_finder_spec.rb @@ -1,9 +1,10 @@ require 'spec_helper' describe PipelinesFinder do - let(:project) { create(:project, :repository) } - - subject { described_class.new(project, params).execute } + let(:project) { create(:project, :public, :repository) } + let(:current_user) { nil } + let(:params) { {} } + subject { described_class.new(project, current_user, params).execute } describe "#execute" do context 'when params is empty' do @@ -223,5 +224,27 @@ describe PipelinesFinder do end end end + + context 'when the project has limited access to piplines' do + let(:project) { create(:project, :private, :repository) } + let(:current_user) { create(:user) } + let!(:pipelines) { create_list(:ci_pipeline, 2, project: project) } + + context 'when the user has access' do + before do + project.add_developer(current_user) + end + + it 'is expected to return pipelines' do + is_expected.to contain_exactly(*pipelines) + end + end + + context 'the user is not allowed to read pipelines' do + it 'returns empty' do + is_expected.to be_empty + end + end + end end end |