summaryrefslogtreecommitdiff
path: root/spec/models/ci
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-03-01 13:07:24 +0100
committerAlexis Reigel <alexis.reigel.ext@siemens.com>2018-04-23 09:06:01 +0200
commit9a07bc819f137a3077784a33e1b36bf6797d9547 (patch)
tree37a69100880ea0ff5bb3595e90d986c6cf33563e /spec/models/ci
parent1549239849adf31a078be7503ab2288795e337cf (diff)
downloadgitlab-ce-9a07bc819f137a3077784a33e1b36bf6797d9547.tar.gz
add misssing scope specs
Diffstat (limited to 'spec/models/ci')
-rw-r--r--spec/models/ci/runner_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index ab170e6351c..529f200b43a 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -49,6 +49,25 @@ describe Ci::Runner do
end
end
+ describe 'scopes' do
+ describe 'owned_or_shared' do
+ it 'returns the specific project runner' do
+ specific_project = create :project
+ other_project = create :project
+ specific_runner = create :ci_runner, :specific, projects: [specific_project]
+ other_runner = create :ci_runner, :specific, projects: [other_project]
+
+ expect(described_class.owned_or_shared(specific_project.id)).to eq [specific_runner]
+ end
+
+ it 'returns the shared projects' do
+ runner = create :ci_runner, :shared
+
+ expect(described_class.owned_or_shared(0)).to eq [runner]
+ end
+ end
+ end
+
describe '#display_name' do
it 'returns the description if it has a value' do
runner = FactoryBot.build(:ci_runner, description: 'Linux/Ruby-1.9.3-p448')