Remove unused let definitions in unit specs

This commit is contained in:
John Backus 2016-09-16 01:04:31 -07:00
parent 6119880ebb
commit 4a63fdf0e1
No known key found for this signature in database
GPG key ID: 9A91898D0B0B2FBE
18 changed files with 4 additions and 69 deletions

View file

@ -37,13 +37,8 @@ module SharedContext
let(:env) { instance_double(Mutant::Env, config: config, subjects: [subject_a], mutations: mutations) }
let(:job_a) { Mutant::Parallel::Job.new(index: 0, payload: mutation_a) }
let(:job_b) { Mutant::Parallel::Job.new(index: 1, payload: mutation_b) }
let(:job_a_result) { Mutant::Runner::JobResult.new(job: job_a, result: mutation_a_result) }
let(:job_b_result) { Mutant::Runner::JobResult.new(job: job_b, result: mutation_b_result) }
let(:test_a) { instance_double(Mutant::Test, identification: 'test-a') }
let(:test_b) { instance_double(Mutant::Test, identification: 'test-b') }
let(:output) { StringIO.new }
let(:matchable_scopes) { instance_double(Array, length: 10) }
let(:message_sequence) { FakeActor::MessageSequence.new }
let(:mutations) { [mutation_a, mutation_b] }
let(:mutation_a_node) { s(:false) }
let(:mutation_b_node) { s(:nil) }
@ -126,13 +121,5 @@ module SharedContext
mutation_results: [mutation_a_result, mutation_b_result]
)
end
let(:empty_subject_a_result) do
subject_a_result.with(mutation_results: [])
end
let(:partial_subject_a_result) do
subject_a_result.with(mutation_results: [mutation_a_result])
end
end
end # SharedContext

View file

@ -10,9 +10,6 @@ RSpec.describe Mutant::Actor::Mailbox do
describe '.new' do
subject { described_class.new }
let(:object) { described_class.new }
let(:thread) { instance_double(Thread) }
its(:sender) { should eql(Mutant::Actor::Sender.new(condition_variable, mutex, [])) }
its(:receiver) { should eql(Mutant::Actor::Receiver.new(condition_variable, mutex, [])) }

View file

@ -66,7 +66,6 @@ RSpec.describe Mutant::CLI do
subject { object.new(arguments) }
# Defaults
let(:expected_filter) { Morpher.evaluator(s(:true)) }
let(:expected_integration) { Mutant::Integration::Null }
let(:expected_reporter) { Mutant::Config::DEFAULT.reporter }
let(:expected_matcher_config) { default_matcher_config }

View file

@ -31,7 +31,6 @@ RSpec.describe Mutant::Context do
end
let(:object) { described_class.new(scope, source_path) }
let(:scope_name) { instance_double(String) }
let(:source_path) { instance_double(Pathname) }
let(:scope) { TestApp::Literal }
@ -60,10 +59,6 @@ RSpec.describe Mutant::Context do
Unparser.unparse(subject)
end
let(:round_tripped_source) do
Unparser.unparse(parse(expected_source))
end
it 'should create correct source' do
expect(generated_source).to eql(expected_source)
end
@ -72,8 +67,6 @@ RSpec.describe Mutant::Context do
describe '#unqualified_name' do
subject { object.unqualified_name }
let(:path) { instance_double(Pathname) }
context 'with top level constant name' do
let(:scope) { TestApp }

View file

@ -14,7 +14,6 @@ RSpec.describe Mutant::Env do
end
let(:integration) { instance_double(Mutant::Integration) }
let(:wrapped_node) { instance_double(Parser::AST::Node) }
let(:context) { instance_double(Mutant::Context) }
let(:test_a) { instance_double(Mutant::Test) }
let(:test_b) { instance_double(Mutant::Test) }

View file

@ -1,6 +1,4 @@
RSpec.describe Mutant::Expression do
let(:object) { described_class }
let(:parser) { Mutant::Config::DEFAULT.expression_parser }
describe '#prefix?' do

View file

@ -1,11 +1,9 @@
RSpec.describe Mutant::Matcher::Compiler, '#call' do
let(:object) { described_class }
let(:env) { Fixtures::TEST_ENV }
let(:matcher_config) { Mutant::Matcher::Config::DEFAULT }
let(:expression_a) { parse_expression('Foo*') }
let(:expression_b) { parse_expression('Bar*') }
let(:matcher_a) { expression_a.matcher }
let(:matcher_b) { expression_b.matcher }
let(:expected_matcher) do
Mutant::Matcher::Filter.new(

View file

@ -5,7 +5,6 @@ RSpec.describe Mutant::Matcher::Method::Instance, '#call' do
let(:method_name) { :foo }
let(:source_path) { MutantSpec::ROOT.join('test_app/lib/test_app.rb') }
let(:method) { scope.instance_method(method_name) }
let(:namespace) { self.class }
let(:type) { :def }
let(:method_arity) { 0 }
let(:base) { TestApp::InstanceMethodTests }
@ -29,7 +28,6 @@ RSpec.describe Mutant::Matcher::Method::Instance, '#call' do
context 'when method is defined inside eval' do
let(:scope) { base::WithMemoizer }
let(:method) { scope.instance_method(:boz) }
let(:method_name) { :boz }
let(:expected_warnings) do
[

View file

@ -26,8 +26,7 @@ RSpec.describe Mutant::Matcher::Method::Singleton, '#call' do
end
context 'when also defined on lvar' do
let(:scope) { base::DefinedOnLvar }
let(:method_line) { 66 }
let(:scope) { base::DefinedOnLvar }
let(:expected_warnings) do
[
'Can only match :defs on :self or :const got :lvar unable to match'

View file

@ -21,9 +21,6 @@ RSpec.describe Mutant::Mutation do
)
end
let(:test_a) { instance_double(Mutant::Test) }
let(:test_b) { instance_double(Mutant::Test) }
describe '#insert' do
subject { object.insert(kernel) }

View file

@ -1,7 +1,5 @@
RSpec.describe Mutant::Mutator do
describe '.handle' do
let(:object) { described_class }
subject do
Class.new(described_class) do
const_set(:REGISTRY, Mutant::Registry.new)

View file

@ -1,7 +1,6 @@
RSpec.describe Mutant::Parallel::Master do
let(:message_sequence) { FakeActor::MessageSequence.new }
let(:actor_names) { %i[master worker_a worker_b] }
let(:status) { instance_double(Mutant::Result::Status) }
let(:sink) { FakeSink.new }
let(:processor) { instance_double(Proc) }
let(:worker_a) { actor_env.mailbox(:worker_a).sender }
@ -135,8 +134,6 @@ RSpec.describe Mutant::Parallel::Master do
end
context 'while jobs are processed' do
let(:expected_results) { [job_result_payload_a] }
let(:sink) do
super().instance_eval do
def stop?

View file

@ -39,7 +39,6 @@ RSpec.describe Mutant::Parallel::Worker do
end
let(:index) { instance_double(Fixnum) }
let(:test_result) { instance_double(Mutant::Result::Test) }
let(:job_result) { Mutant::Parallel::JobResult.new(job: job, payload: result_payload) }
let(:job) { Mutant::Parallel::Job.new(index: index, payload: payload) }

View file

@ -1,9 +1,7 @@
RSpec.describe Mutant::Registry do
let(:lookup) { object.lookup(type) }
let(:object) { described_class.new }
let(:mutator) { class_double(Mutant::Mutator) }
let(:node) { s(:true) }
let(:expected_arguments) { [node, nil] }
let(:lookup) { object.lookup(type) }
let(:object) { described_class.new }
let(:mutator) { class_double(Mutant::Mutator) }
def register_mutator
object.register(type, mutator)

View file

@ -21,12 +21,6 @@ RSpec.describe Mutant::Result::Mutation do
)
end
let(:mutation_subject) do
instance_double(
Mutant::Subject
)
end
describe '#runtime' do
subject { object.runtime }

View file

@ -50,17 +50,6 @@ RSpec.describe Mutant::Runner do
subject { described_class.call(env) }
context 'when runner finishes immediately' do
let(:status) { instance_double(Mutant::Parallel::Status, done: true, payload: env_result) }
before do
expect(driver).to receive(:status).and_return(status)
expect(reporter).to receive(:progress).with(status).ordered
expect(driver).to receive(:stop).ordered
expect(reporter).to receive(:report).with(env_result).ordered
end
end
context 'when report iterations are done' do
let(:status_a) { instance_double(Mutant::Parallel::Status, done: false) }
let(:status_b) { instance_double(Mutant::Parallel::Status, done: true, payload: env_result) }

View file

@ -19,7 +19,6 @@ RSpec.describe Mutant::Selector::Expression do
let(:mutation_subject) { subject_class.new(context, node) }
let(:context) { instance_double(Mutant::Context) }
let(:node) { instance_double(Parser::AST::Node) }
let(:config) { Mutant::Config::DEFAULT.with(integration: integration) }
let(:integration) { instance_double(Mutant::Integration, all_tests: all_tests) }
let(:test_a) { instance_double(Mutant::Test, expression: parse_expression('SubjectA')) }
let(:test_b) { instance_double(Mutant::Test, expression: parse_expression('SubjectB')) }

View file

@ -23,10 +23,6 @@ RSpec.describe Mutant::Subject do
RUBY
end
let(:expression) do
instance_double(Mutant::Expression, line: 'source_line')
end
let(:context) do
double(
'Context',