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

Check for RSpec::Matchers rather than requiring it in begin/rescue block #446

Open
jsmestad opened this issue Nov 1, 2019 · 4 comments
Open
Labels
⚡ enhancement Request for new functionality

Comments

@jsmestad
Copy link

jsmestad commented Nov 1, 2019

Summary

I am working on a project where MiniTest and rspec-mocks, rspec-expectations are both available in the Gemfile. However we have RSpec disabled as we do not use RSpec assertions in Cucumber. This is causing an issue with cucumber-rails where it tries to load RSpec expectations and matchers regardless of them being necessary.

Expected Behavior

Tests run fine without RSpec getting loaded when the Gemfile has require: false for those libraries.

Current Behavior

assert_equal with capybara fails due to rspec-expectations changing its behavior from vanilla minitest.

Possible Solution

Changing line the lib/rspec.rb file to check for defined?(RSpec::Mock) would allow for these two libraries to co-exist without causing a conflict.

@aslakhellesoy
Copy link
Contributor

Sounds good to me @jsmestad - could you send us a PR for this please?

@aslakhellesoy
Copy link
Contributor

Ah you did already :-)
#446

@aslakhellesoy
Copy link
Contributor

Please ignore my last comment - time to log off for the weekend :-)

@luke-hill
Copy link
Contributor

As an update to any new contributor / interested party. The main issue with this is that we assume you want to use rspec. As such it isn't required to enable this by the user.

Given the use-case here is to have combinations of gems existing but not functional. One plan of attack (Maybe not the best), is to simply remove all testing requirements. This would require changes of gem packages, require statements - probably meaning a major version bump.

Alternate options are valid, but weren't POC'd.

@aslakhellesoy aslakhellesoy added the ⚡ enhancement Request for new functionality label Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ enhancement Request for new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants