cucumber-rails
cucumber-rails copied to clipboard
Check for RSpec::Matchers rather than requiring it in begin/rescue block
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.
Sounds good to me @jsmestad - could you send us a PR for this please?
Ah you did already :-) https://github.com/cucumber/cucumber-rails/issues/446
Please ignore my last comment - time to log off for the weekend :-)
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.
Closing due to inactivity