Remove unused and LSP incompatible Reporter::Trace

This commit is contained in:
Markus Schirp 2015-11-16 01:21:57 +00:00
parent 3cea008fcd
commit b3550e6792
7 changed files with 16 additions and 83 deletions

View file

@ -1,3 +1,3 @@
---
threshold: 18
total_score: 1208
total_score: 1177

View file

@ -168,7 +168,6 @@ require 'mutant/runner/sink'
require 'mutant/result'
require 'mutant/reporter'
require 'mutant/reporter/null'
require 'mutant/reporter/trace'
require 'mutant/reporter/cli'
require 'mutant/reporter/cli/printer'
require 'mutant/reporter/cli/printer/config'

View file

@ -1,36 +0,0 @@
module Mutant
class Reporter
# Reporter to trace report calls, used as a spec adapter
class Trace
include Adamantium::Mutable, Anima.new(:start_calls, :progress_calls, :report_calls, :warn_calls)
# New trace reporter
#
# @return [Trace]
#
# @api private
def self.new
super(Hash[anima.attribute_names.map { |name| [name, []] }])
end
%w[start progress report warn].each do |name|
define_method(name) do |object|
public_send(:"#{name}_calls") << object
self
end
end
REPORT_DELAY = 0.0
# Report delay
#
# @return [Float]
#
# @api private
def delay
REPORT_DELAY
end
end # Tracker
end # reporter
end # Mutant

View file

@ -33,7 +33,7 @@ $LOAD_PATH << File.join(TestApp.root, 'lib')
require 'test_app'
module Fixtures
TEST_CONFIG = Mutant::Config::DEFAULT.with(reporter: Mutant::Reporter::Trace.new)
TEST_CONFIG = Mutant::Config::DEFAULT.with(reporter: Mutant::Reporter::Null.new)
TEST_ENV = Mutant::Env::Bootstrap.(TEST_CONFIG)
end # Fixtures

View file

@ -53,7 +53,7 @@ module SharedContext
let(:config) do
Mutant::Config::DEFAULT.with(
jobs: 1,
reporter: Mutant::Reporter::Trace.new
reporter: Mutant::Reporter::Null.new
)
end

View file

@ -16,7 +16,7 @@ RSpec.describe Mutant::Env::Bootstrap do
let(:config) do
Mutant::Config::DEFAULT.with(
jobs: 1,
reporter: Mutant::Reporter::Trace.new,
reporter: instance_double(Mutant::Reporter),
includes: [],
requires: [],
integration: integration_class,
@ -59,11 +59,10 @@ RSpec.describe Mutant::Env::Bootstrap do
subject { object.warn(message) }
it 'reports a warning' do
expect { subject }
.to change { config.reporter.warn_calls }
.from([])
.to([message])
before do
expect(config.reporter).to receive(:warn)
.with(message)
.and_return(config.reporter)
end
it_behaves_like 'a command method'
@ -92,16 +91,14 @@ RSpec.describe Mutant::Env::Bootstrap do
end
end
it 'warns via reporter' do
expected_warnings = [
before do
expected_warning =
"Class#name from: #{invalid_class} raised an error: " \
"RuntimeError. #{Mutant::Env::SEMANTICS_MESSAGE}"
]
expect { subject }
.to change { config.reporter.warn_calls }
.from([])
.to(expected_warnings)
expect(config.reporter).to receive(:warn)
.with(expected_warning)
.and_return(config.reporter)
end
include_examples 'bootstrap call'
@ -155,14 +152,11 @@ RSpec.describe Mutant::Env::Bootstrap do
end
end
it 'warns via reporter' do
expected_warnings = [
before do
expected_warning =
"Class#name from: #{invalid_class.inspect} returned Object. #{Mutant::Env::SEMANTICS_MESSAGE}"
]
expect { subject }
.to change { config.reporter.warn_calls }
.from([]).to(expected_warnings)
expect(config.reporter).to receive(:warn).with(expected_warning).and_return(config.reporter)
end
include_examples 'bootstrap call'

View file

@ -1,24 +0,0 @@
RSpec.describe Mutant::Reporter::Trace do
let(:object) { described_class.new }
describe '#delay' do
subject { object.delay }
it { should eql(0.0) }
end
let(:value) { instance_double(Object) }
%i[report start progress].each do |name|
describe "##{name}" do
subject { object.public_send(name, value) }
it 'logs the value' do
expect { subject }
.to change { object.public_send("#{name}_calls") }
.from([])
.to([value])
end
end
end
end