|
97 | 97 | @object.load(path, true)
|
98 | 98 |
|
99 | 99 | Object.const_defined?(:LoadSpecWrap).should be_false
|
| 100 | + |
| 101 | + wrap_module = ScratchPad.recorded[1] |
| 102 | + wrap_module.should be_an_instance_of(Module) |
100 | 103 | end
|
101 | 104 |
|
102 | 105 | it "allows referencing outside namespaces" do
|
103 | 106 | path = File.expand_path "wrap_fixture.rb", CODE_LOADING_DIR
|
104 | 107 | @object.load(path, true)
|
105 | 108 |
|
106 |
| - ScratchPad.recorded.first.should equal(String) |
| 109 | + ScratchPad.recorded[0].should equal(String) |
107 | 110 | end
|
108 | 111 |
|
109 | 112 | it "sets self as a copy of the top-level main" do
|
110 | 113 | path = File.expand_path "wrap_fixture.rb", CODE_LOADING_DIR
|
111 | 114 | @object.load(path, true)
|
112 | 115 |
|
113 |
| - top_level = ScratchPad.recorded.last |
| 116 | + top_level = ScratchPad.recorded[2] |
114 | 117 | top_level.to_s.should == "main"
|
| 118 | + top_level.method(:to_s).owner.should == top_level.singleton_class |
115 | 119 | top_level.should_not equal(main)
|
116 | 120 | top_level.should be_an_instance_of(Object)
|
117 | 121 | end
|
|
126 | 130 | path = File.expand_path "wrap_fixture.rb", CODE_LOADING_DIR
|
127 | 131 | @object.load(path, true)
|
128 | 132 |
|
129 |
| - top_level = ScratchPad.recorded.last |
| 133 | + top_level = ScratchPad.recorded[2] |
130 | 134 | top_level_ancestors = top_level.singleton_class.ancestors[-main_ancestors.size..-1]
|
131 | 135 | top_level_ancestors.should == main_ancestors
|
| 136 | + |
| 137 | + wrap_module = ScratchPad.recorded[1] |
| 138 | + top_level.singleton_class.ancestors.should == [top_level.singleton_class, wrap_module, *main_ancestors] |
132 | 139 | end
|
133 | 140 |
|
134 | 141 | describe "with top-level methods" do
|
|
0 commit comments