Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Mocha compatibility #2256

Merged
merged 1 commit into from Jan 9, 2020
Merged

Fix Mocha compatibility #2256

merged 1 commit into from Jan 9, 2020

Conversation

pirj
Copy link
Member

@pirj pirj commented Jan 8, 2020

RSpec Mocks happened to load its configuration, use the default syntax and define any_instance on Class before Mocha had a chance to in case rspec/rails was required in spec/spec_helper.rb before rspec/core and configuring Mocha as mock_with.

This is not something typical, as usually rails_helper.rb requires rspec-rails, and spec_helper.rb requires rspec-core and configures mock_with, but not something that is a complete no-no.

fixes #2252

  • add changelog

@pirj pirj self-assigned this Jan 8, 2020
@pirj
Copy link
Member Author

pirj commented Jan 8, 2020

@ZeroPointEnergy highly appreciate if you test this fix out with puppet-dashboard.

@benoittgt
Copy link
Member

Thanks for the patch. Do you think we can test it in rspec-rails?

Waiting for @ZeroPointEnergy feedback.

@pirj
Copy link
Member Author

pirj commented Jan 9, 2020

Do you think we can test it in rspec-rails?

I'm open to ideas how to do that.

@ZeroPointEnergy
Copy link

@pirj is it possible that the PR is not on the 4.x development branch? It threw some dependency errors when I tried to use the branch directly.

However I simply cherry-picked ac886dc on top of v4.0.0.beta3 and can confirm that the patch indeed fixes the issue in puppet-dashboard! 👍

Thanks a lot for your work.

@JonRowe
Copy link
Member

JonRowe commented Jan 9, 2020

Honestly I'm ok with just adding a comment on top explaining why the minimalist approach is taken. To add a test you'd have to assert a bunch of stuff about poisoning the environment which is a fair amount of effort to setup...

RSpec Mocks happened to load its configuration, use the default syntax
and define `any_instance` on `Class` before Mocha had a chance to in
case `rspec/rails` was required in `spec/spec_helper.rb`.

fixes #2252
@pirj
Copy link
Member Author

pirj commented Jan 9, 2020

Looks green.

@pirj pirj merged commit 44dd31d into master Jan 9, 2020
@pirj pirj deleted the fix-mocha-compatibility branch January 9, 2020 16:52
@pirj
Copy link
Member Author

pirj commented Jan 9, 2020

Rushed it a bit. @benoittgt do you have any objections on merging as is? I can do a follow-up in that case.

@benoittgt
Copy link
Member

No no it's perfect! Thanks a lot 😊

JonRowe pushed a commit that referenced this pull request Jan 12, 2020
@JonRowe
Copy link
Member

JonRowe commented Jan 12, 2020

Released as v.4.0.0.beta4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v4.0.0.beta3 regression when using mocha
4 participants