Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Choose acceptance type instead of turnip #66

Closed
sobrinho opened this Issue · 5 comments

4 participants

@sobrinho

Hi @jnicklas,

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:

module CustomersSteps
  ...
end

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
end

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.

WDYT?

@dasch

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.

@jnicklas jnicklas referenced this issue in jnicklas/capybara
Merged

set rspec type to :feature instead #809

@jnicklas
Owner

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.

@jnicklas jnicklas closed this
@sobrinho

Thanks @jnicklas :)

@dchelimsky

@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?

@jnicklas
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.