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

Add RSpec::Machers support #87

Closed
pwoloszun opened this issue Dec 6, 2011 · 9 comments
Closed

Add RSpec::Machers support #87

pwoloszun opened this issue Dec 6, 2011 · 9 comments
Labels

Comments

@pwoloszun
Copy link

Currently in order to use RSpec machers in steps definitions I've got to:

  1. require 'rspec' in env.rb
  2. add: include RSpec::Machers, to each step class(class that inherits from Spinach::FeatureSteps)
@josepjaume
Copy link
Contributor

Oh, you could also make something like reopening the FeatureSteps class and
add them there:

In env.rb:

Spinach::FeatureSteps.send(:include, RSpec::Matchers)

But I agree this could be added to the default rspec support.

@sheldonh
Copy link

Similarly, for methods like double() from rspec-mocks to work:

Spinach::FeatureSteps.send(:include, RSpec::Mocks::ExampleMethods)

Having to do this manually makes "works out of the box with your favourite test framework" is a bit of a stretch. :-)

@txus
Copy link
Member

txus commented Sep 14, 2012

I agree with auto-including RSpec if it exists. What do you think @josepjaume @oriolgual ?

@oriolgual
Copy link
Member

Sure, send a PR and we'll merge it :D

@oriolgual
Copy link
Member

This was actually solved 9 months ago by @josepjaume, see dccd46f

@paullaz
Copy link

paullaz commented May 1, 2014

Interestingly I still must do
"In env.rb: Spinach::FeatureSteps.send(:include, RSpec::Matchers)"
to get this to work.

@oriolgual
Copy link
Member

Which version of Rspec are you using? In your Gemfile, is defined spinach before rspec?

@paullaz
Copy link

paullaz commented May 5, 2014

I'm using rspec (2.14.1)

My gemfile reads for development & test:
group :development, :test do
gem 'rspec-rails', '> 2.0'
gem 'rspec'
gem 'spinach-rails'
gem 'spring-commands-spinach'
gem 'factory_girl_rails', "
> 4.0"
gem 'ruby-debug-ide'
gem 'debase'
gem 'spring'
end
group :test do
gem 'shoulda-matchers', require: false
gem 'database_cleaner'
gem 'selenium-webdriver'
gem 'minitest'
gem 'capybara_minitest_spec'
gem 'launchy'
end

Should I explicity define spinach and put it and spinach-rails before rspec items?

@montnyc
Copy link

montnyc commented Jul 31, 2016

@paullaz I got around having to use Spinach::FeatureSteps.send(:include, RSpec::Matchers) by requiring rspec/expectations in env.rb.
Spinach::FeatureSteps.include RSpec::Matchers will return nil without this, because at this point, Rails only has the RSpec::Rails module.

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

No branches or pull requests

7 participants