summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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')