debian-mirror-gitlab/spec/graphql/resolvers/ci/runner_status_resolver_spec.rb

41 lines
1 KiB
Ruby
Raw Normal View History

2022-01-26 12:08:38 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Resolvers::Ci::RunnerStatusResolver do
include GraphqlHelpers
describe '#resolve' do
let(:user) { build(:user) }
let(:runner) { build(:ci_runner) }
subject(:resolve_subject) { resolve(described_class, ctx: { current_user: user }, obj: runner, args: args) }
context 'with legacy_mode' do
context 'set to 14.5' do
let(:args) do
{ legacy_mode: '14.5' }
end
it 'calls runner.status with specified legacy_mode' do
expect(runner).to receive(:status).with('14.5').once.and_return(:online)
expect(resolve_subject).to eq(:online)
end
end
context 'set to nil' do
let(:args) do
{ legacy_mode: nil }
end
it 'calls runner.status with specified legacy_mode' do
expect(runner).to receive(:status).with(nil).once.and_return(:stale)
expect(resolve_subject).to eq(:stale)
end
end
end
end
end