Currently capybara have this configuration:
config.include Capybara::DSL, :type => :request
config.include Capybara::DSL, :type => :acceptance
config.include Capybara::RSpecMatchers, :type => :request
config.include Capybara::RSpecMatchers, :type => :acceptance
And on turnip:
Turnip.type = :turnip
And on turnip/capybara:
Turnip.type = :request
And turnip readme suggests to use a folder named acceptance, like spec/acceptance/attack_monster.feature.
Do not make more sense call the turnip specs as acceptance specs instead of turnip specs in one situation and request specs in other situation?
That's not a big deal but caused a lot of confusion in my mind until I setup one real application because I have specific steps, like this one:
RSpec.configure do |config|
# my first guess:
config.include CustomerSteps, :type => :acceptance
# but without capybara is:
config.include CustomerSteps, :type => :turnip
# and with capybara is:
config.include CustomerSteps, :type => :request
Calling turnip specs always as acceptance specs will include capybara by default if it's available.
I think that will be a good thing since I will not need to setup turnip to integrate with capybara on every project :)
If capybara isn't available, nothing will happen, the turnip specs will continue to be called acceptance specs.
I think it's actually a better idea to do config.include Foo, turnip: true. All Turnip specs are tagged with :turnip, so it will work no matter what Turnip.type is.
config.include Foo, turnip: true
As discussed in jnicklas/capybara#809, we're setting the type to feature. I also removed the type accessor, as it seemed redundant to me.
Thanks @jnicklas :)
@jnicklas, @sobrinho the change I'm making in rspec-rails is to include Capybara::DSL, Capybara::RSpecMatchers, and RSpec::Rails::RailsExampleGroup in groups declared in the spec/features directory. This does not add :type => :feature to those groups. Does it need to to support turnip?
:type => :feature
Since capybara/rspec includes itself in :type => :feature examples, I think it should work fine. I switched over a project to Turnip and Capybara master and everything just worked without any changes to rspec, so I think we should be fine. Not sure how this would affect Rails helpers, like routes and stuff like that though.