Skip to content

shush_backtraces breaks Minitest::Mock #350

Closed
@mattbrictson

Description

@mattbrictson

Monkey patching Kernel#raise in shush_backtraces causes Minitest::Mock to blow up with infinite recursion:

mock = Minitest::Mock.new
mock.expect(:meaning_of_life, 42)
mock.verify
SystemStackError: stack level too deep

Minitest::Mock is calling raise, which triggers method_missing, which calls raise, and on and on.

Somehow spring's redefinition of raise causes it to be added to Kernel.instance_methods (usually it is not there).

With spring loaded:

Kernel.instance_methods.include?(:raise)
=> true

Without spring loaded:

Kernel.instance_methods.include?(:raise)
=> false

This affects how Minitest::Mock does its magic, leading to the infinite recursion problem.

Is there another way shush_backtraces can be written that doesn't cause this problem?

Rails 4.1.5
Spring 1.1.3
Minitest 5.4.1
ruby 2.1.2p95

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions