From 00647b31b4741102451a2d785a43ef14bb818e24 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Wed, 6 Jun 2018 15:29:40 +0200 Subject: add offline scope to Ci::Runner --- spec/models/ci/runner_spec.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index 953af2c4710..f1d0ed15d29 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -223,7 +223,7 @@ describe Ci::Runner do subject { described_class.online } before do - @runner1 = create(:ci_runner, :instance, contacted_at: 1.year.ago) + @runner1 = create(:ci_runner, :instance, contacted_at: 1.hour.ago) @runner2 = create(:ci_runner, :instance, contacted_at: 1.second.ago) end @@ -300,6 +300,17 @@ describe Ci::Runner do end end + describe '.offline' do + subject { described_class.offline } + + before do + @runner1 = create(:ci_runner, :instance, contacted_at: 1.hour.ago) + @runner2 = create(:ci_runner, :instance, contacted_at: 1.second.ago) + end + + it { is_expected.to eq([@runner1])} + end + describe '#can_pick?' do set(:pipeline) { create(:ci_pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) } -- cgit v1.2.1