Files
codeocean/spec/lib/testing_framework_adapter_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

51 lines
1.4 KiB
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe TestingFrameworkAdapter do
let(:adapter) { described_class.new }
let(:count) { 42 }
let(:failed) { 25 }
let(:passed) { 17 }
describe '#augment_output' do
context 'when missing the count of all tests' do
it 'adds the count of all tests' do
expect(adapter.send(:augment_output, failed:, passed:)).to include(count:)
end
end
context 'when missing the count of failed tests' do
it 'adds the count of failed tests' do
expect(adapter.send(:augment_output, count:, passed:)).to include(failed:)
end
end
context 'when missing the count of passed tests' do
it 'adds the count of passed tests' do
expect(adapter.send(:augment_output, count:, failed:)).to include(passed:)
end
end
end
describe '.framework_name' do
it 'defaults to the class name' do
expect(adapter.class.framework_name).to eq(described_class.name)
end
end
describe '#parse_output' do
it 'requires subclasses to implement #parse_output' do
expect { adapter.send(:parse_output, '') }.to raise_error(NotImplementedError)
end
end
describe '#test_outcome' do
it 'calls the framework-specific implementation' do
allow(adapter).to receive(:parse_output).and_return(count:, failed:, passed:)
expect(adapter).to receive(:parse_output)
adapter.test_outcome('')
end
end
end