Use class_double where appropriate

This commit is contained in:
Markus Schirp 2016-01-24 21:16:43 +00:00
parent efd1202223
commit 8439096e11
6 changed files with 21 additions and 27 deletions

View file

@ -1,6 +1,6 @@
RSpec.describe Mutant::Actor::Env do
let(:thread) { instance_double(Thread) }
let(:thread_root) { instance_double(Thread.singleton_class) }
let(:thread) { instance_double(Thread) }
let(:thread_root) { class_double(Thread) }
let(:object) { described_class.new(thread_root) }

View file

@ -13,18 +13,15 @@ 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) }
let(:tests) { [test_a, test_b] }
let(:selector) { instance_double(Mutant::Selector) }
let(:integration_class) { Mutant::Integration::Null }
let(:isolation) do
instance_double(Mutant::Isolation::Fork.singleton_class)
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) }
let(:tests) { [test_a, test_b] }
let(:selector) { instance_double(Mutant::Selector) }
let(:integration_class) { Mutant::Integration::Null }
let(:isolation) { class_double(Mutant::Isolation::Fork) }
let(:mutation) do
instance_double(
@ -37,7 +34,7 @@ RSpec.describe Mutant::Env do
Mutant::Config::DEFAULT.with(
isolation: isolation,
integration: integration_class,
kernel: instance_double(Kernel.singleton_class)
kernel: class_double(Kernel)
)
end

View file

@ -11,7 +11,7 @@ RSpec.describe Mutant::Loader, '.call' do
let(:path) { instance_double(Pathname, to_s: path_str) }
let(:path_str) { instance_double(String) }
let(:line) { instance_double(Fixnum) }
let(:kernel) { instance_double(Kernel.singleton_class) }
let(:kernel) { class_double(Kernel) }
let(:binding) { instance_double(Binding) }
let(:source) { instance_double(String) }
let(:node) { instance_double(Parser::AST::Node) }

View file

@ -17,12 +17,12 @@ describe Mutant::Repository::Diff do
)
end
let(:pathname) { instance_double(Pathname.singleton_class, pwd: pwd) }
let(:open3) { instance_double(Open3.singleton_class) }
let(:kernel) { instance_double(Kernel.singleton_class) }
let(:pwd) { Pathname.new('/foo') }
let(:path) { Pathname.new('/foo/bar.rb') }
let(:line_range) { 1..2 }
let(:pathname) { class_double(Pathname, pwd: pwd) }
let(:open3) { class_double(Open3) }
let(:kernel) { class_double(Kernel) }
let(:pwd) { Pathname.new('/foo') }
let(:path) { Pathname.new('/foo/bar.rb') }
let(:line_range) { 1..2 }
subject { object.touches?(path, line_range) }

View file

@ -6,7 +6,7 @@ RSpec.describe Mutant::Runner do
let(:delay) { instance_double(Float) }
let(:env_result) { instance_double(Mutant::Result::Env) }
let(:actor_env) { instance_double(Mutant::Actor::Env) }
let(:kernel) { instance_double(Kernel.singleton_class) }
let(:kernel) { class_double(Kernel) }
let(:sleep) { instance_double(Method) }
let(:env) do

View file

@ -1,9 +1,6 @@
RSpec.describe Mutant::Zombifier do
let(:root_require) { Pathname.new('project') }
let(:pathname) do
instance_double(::Pathname.singleton_class)
end
let(:pathname) { class_double(Pathname) }
let(:require_highjack) do
lambda do |block|