From 9a07bc819f137a3077784a33e1b36bf6797d9547 Mon Sep 17 00:00:00 2001 From: Alexis Reigel <mail@koffeinfrei.org> Date: Wed, 1 Mar 2017 13:07:24 +0100 Subject: [PATCH] add misssing scope specs --- spec/models/ci/runner_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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') -- 2.30.9