Files
codeocean/spec/helpers/admin/dashboard_helper_spec.rb
Sebastian Serth 99bd46af1a Align project files with CodeHarbor
Since both projects are developed together and by the same team, we also want to have the same code structure and utility methods available in both projects. Therefore, this commit changes many files, but without a functional change.
2023-10-11 00:18:33 +02:00

37 lines
1.0 KiB
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Admin::DashboardHelper do
before do
create(:ruby)
dcp = class_double Runner::Strategy::DockerContainerPool
allow(Runner).to receive(:strategy_class).and_return dcp
allow(dcp).to receive(:pool_size).and_return({})
end
describe '#dashboard_data' do
it 'includes Docker-related data' do
expect(dashboard_data).to include(:docker)
end
end
describe '#docker_data' do
it 'contains an entry for every execution environment' do
expect(docker_data.length).to eq(ExecutionEnvironment.count)
end
it 'contains the pool size for every execution environment' do
expect(docker_data.first.symbolize_keys).to include(:prewarmingPoolSize)
end
it 'contains the number of idle runners for every execution environment' do
expect(docker_data.first).to include(:idleRunners)
end
it 'contains the number of used runners for every execution environment' do
expect(docker_data.first).to include(:usedRunners)
end
end
end