Skip to content

Commit

Permalink
Specs: Use Runner factory and provide strategy class
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSerth committed Oct 31, 2023
1 parent 8fc5123 commit 411eb0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions spec/factories/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
runner_id { SecureRandom.uuid }
execution_environment factory: :ruby
contributor factory: :external_user

after(:build) do |runner|
runner.strategy = Runner.strategy_class.new(runner.runner_id, runner.execution_environment)
end
end
end
6 changes: 3 additions & 3 deletions spec/models/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
end

describe '#destroy_at_management' do
let(:runner) { described_class.create }
let(:runner) { create(:runner) }

before do
allow(strategy_class).to receive_messages(request_from_management: runner_id, new: strategy)
Expand All @@ -66,7 +66,7 @@
end

describe '#attach to execution' do
let(:runner) { described_class.create }
let(:runner) { create(:runner) }
let(:command) { 'ls' }
let(:event_loop) { instance_double(Runner::EventLoop) }
let(:connection) { instance_double(Runner::Connection) }
Expand Down Expand Up @@ -123,7 +123,7 @@
end

describe '#copy_files' do
let(:runner) { described_class.create }
let(:runner) { create(:runner) }

before do
allow(strategy_class).to receive_messages(request_from_management: runner_id, new: strategy)
Expand Down

0 comments on commit 411eb0b

Please sign in to comment.