Skip to content

Commit d0e3f0d

Browse files
authored
Merge pull request #893 from mbj/add/object-space-to-world
Add ObjectSpace to Mutant::World
2 parents 5435393 + 6225fb0 commit d0e3f0d

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

lib/mutant.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ module Mutant
198198
load_path: $LOAD_PATH,
199199
marshal: Marshal,
200200
mutex: Mutex,
201+
object_space: ObjectSpace,
201202
open3: Open3,
202203
pathname: Pathname,
203204
process: Process,

lib/mutant/config.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class World
1010
:load_path,
1111
:marshal,
1212
:mutex,
13+
:object_space,
1314
:open3,
1415
:pathname,
1516
:process,

lib/mutant/env/bootstrap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def matched_subjects
125125
#
126126
# @return [undefined]
127127
def initialize_matchable_scopes
128-
scopes = ObjectSpace.each_object(Module).each_with_object([]) do |scope, aggregate|
128+
scopes = world.object_space.each_object(Module).each_with_object([]) do |scope, aggregate|
129129
expression = expression(scope) || next
130130
aggregate << Scope.new(scope, expression)
131131
end

spec/unit/mutant/env/bootstrap_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@
33
RSpec.describe Mutant::Env::Bootstrap do
44
let(:integration) { instance_double(Mutant::Integration) }
55
let(:integration_class) { instance_double(Class) }
6+
let(:kernel) { instance_double(Object, 'kernel') }
67
let(:load_path) { %w[original] }
78
let(:matcher_config) { Mutant::Matcher::Config::DEFAULT }
9+
let(:object_space) { class_double(ObjectSpace) }
810
let(:object_space_modules) { [] }
9-
let(:kernel) { instance_double(Object, 'kernel') }
1011

1112
let(:world) do
1213
instance_double(
1314
Mutant::World,
14-
kernel: kernel,
15-
load_path: load_path,
16-
pathname: Pathname
15+
kernel: kernel,
16+
load_path: load_path,
17+
object_space: object_space,
18+
pathname: Pathname
1719
)
1820
end
1921

@@ -60,7 +62,7 @@ def expect_warning
6062

6163
expect(integration).to receive_messages(setup: integration)
6264

63-
expect(ObjectSpace).to receive(:each_object)
65+
expect(object_space).to receive(:each_object)
6466
.with(Module)
6567
.and_return(object_space_modules.each)
6668
end

0 commit comments

Comments
 (0)