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 RSpec.describe Mutant::Actor::Env do
let(:thread) { instance_double(Thread) } let(:thread) { instance_double(Thread) }
let(:thread_root) { instance_double(Thread.singleton_class) } let(:thread_root) { class_double(Thread) }
let(:object) { described_class.new(thread_root) } let(:object) { described_class.new(thread_root) }

View file

@ -21,10 +21,7 @@ RSpec.describe Mutant::Env do
let(:tests) { [test_a, test_b] } let(:tests) { [test_a, test_b] }
let(:selector) { instance_double(Mutant::Selector) } let(:selector) { instance_double(Mutant::Selector) }
let(:integration_class) { Mutant::Integration::Null } let(:integration_class) { Mutant::Integration::Null }
let(:isolation) { class_double(Mutant::Isolation::Fork) }
let(:isolation) do
instance_double(Mutant::Isolation::Fork.singleton_class)
end
let(:mutation) do let(:mutation) do
instance_double( instance_double(
@ -37,7 +34,7 @@ RSpec.describe Mutant::Env do
Mutant::Config::DEFAULT.with( Mutant::Config::DEFAULT.with(
isolation: isolation, isolation: isolation,
integration: integration_class, integration: integration_class,
kernel: instance_double(Kernel.singleton_class) kernel: class_double(Kernel)
) )
end end

View file

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

View file

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

View file

@ -6,7 +6,7 @@ RSpec.describe Mutant::Runner do
let(:delay) { instance_double(Float) } let(:delay) { instance_double(Float) }
let(:env_result) { instance_double(Mutant::Result::Env) } let(:env_result) { instance_double(Mutant::Result::Env) }
let(:actor_env) { instance_double(Mutant::Actor::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(:sleep) { instance_double(Method) }
let(:env) do let(:env) do

View file

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