Specs: Use Runner factory and provide strategy class
This commit is contained in:

committed by
Sebastian Serth

parent
8fc5123bae
commit
411eb0b165
@ -6,5 +6,9 @@ FactoryBot.define do
|
|||||||
runner_id { SecureRandom.uuid }
|
runner_id { SecureRandom.uuid }
|
||||||
execution_environment factory: :ruby
|
execution_environment factory: :ruby
|
||||||
contributor factory: :external_user
|
contributor factory: :external_user
|
||||||
|
|
||||||
|
after(:build) do |runner|
|
||||||
|
runner.strategy = Runner.strategy_class.new(runner.runner_id, runner.execution_environment)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -53,7 +53,7 @@ RSpec.describe Runner do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#destroy_at_management' do
|
describe '#destroy_at_management' do
|
||||||
let(:runner) { described_class.create }
|
let(:runner) { create(:runner) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(strategy_class).to receive_messages(request_from_management: runner_id, new: strategy)
|
allow(strategy_class).to receive_messages(request_from_management: runner_id, new: strategy)
|
||||||
@ -66,7 +66,7 @@ RSpec.describe Runner do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#attach to execution' do
|
describe '#attach to execution' do
|
||||||
let(:runner) { described_class.create }
|
let(:runner) { create(:runner) }
|
||||||
let(:command) { 'ls' }
|
let(:command) { 'ls' }
|
||||||
let(:event_loop) { instance_double(Runner::EventLoop) }
|
let(:event_loop) { instance_double(Runner::EventLoop) }
|
||||||
let(:connection) { instance_double(Runner::Connection) }
|
let(:connection) { instance_double(Runner::Connection) }
|
||||||
@ -123,7 +123,7 @@ RSpec.describe Runner do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#copy_files' do
|
describe '#copy_files' do
|
||||||
let(:runner) { described_class.create }
|
let(:runner) { create(:runner) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(strategy_class).to receive_messages(request_from_management: runner_id, new: strategy)
|
allow(strategy_class).to receive_messages(request_from_management: runner_id, new: strategy)
|
||||||
|
Reference in New Issue
Block a user