Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions lib/power_assert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module PowerAssert

class << self
def start(assertion_proc_or_source, assertion_method: nil, source_binding: TOPLEVEL_BINDING)
clear_global_method_cache
yield Context.new(assertion_proc_or_source, assertion_method, source_binding)
end

Expand All @@ -48,16 +47,5 @@ def internal_file?(file)
file.start_with?(dir)
end
end

CLEAR_CACHE_ISEQ = RubyVM::InstructionSequence.compile('using PowerAssert.const_get(:Empty)')
private_constant :CLEAR_CACHE_ISEQ

def clear_global_method_cache
CLEAR_CACHE_ISEQ.eval
end
end

module Empty
end
private_constant :Empty
end
22 changes: 10 additions & 12 deletions test/block_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -351,19 +351,17 @@ def inspect; '#<Class>'; end
end
end

if PowerAssert.respond_to?(:clear_global_method_cache, true)
t do
3.times do
assert_equal <<END.chomp, assertion_message {
String == Array
| | |
| | Array
| false
String
t do
3.times do
assert_equal <<END.chomp, assertion_message {
String == Array
| | |
| | Array
| false
String
END
String == Array
}
end
String == Array
}
end
end
end
Expand Down