Skip to content

v4.0.0.beta3 regression when using mocha #2252

@ZeroPointEnergy

Description

@ZeroPointEnergy

What Ruby, Rails and RSpec versions are you using?

Ruby version: 2.6.5p114
Rails version: 6.0.2.1
RSpec version: 4.0.0.beta2

The application in question uses the mocha gem together with rspec-rails

Observed behaviour

WIth 4.0.0.beta3 if I use something like this:
Node.any_instance.stubs(:compiled_parameters).raises ParameterConflictError
I get the following error:
The use of doubles or partial doubles from rspec-mocks outside of the per-test lifecycle is not supported

Expected behaviour

With 4.0.0.beta2 the same tests run flawlessly.

I bisected the issue and git pointed to 7ff7c3e as the first problematic commit.

The only added code outside of tests is require 'rspec/rails/matchers/have_enqueued_mail' which in turn does require "rspec/mocks". This leads to the test now jumping into rspec::mocks (https://github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/syntax.rb#L78) instead of using the method from the mocha gem.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions