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

Choose acceptance type instead of turnip #66

Closed
sobrinho opened this issue Aug 12, 2012 · 5 comments
Closed

Choose acceptance type instead of turnip #66

sobrinho opened this issue Aug 12, 2012 · 5 comments

Comments

@sobrinho
Copy link
Contributor

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
Copy link
Contributor

dasch commented Sep 7, 2012

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
Copy link
Owner

jnicklas commented Sep 9, 2012

As discussed in teamcapybara/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 as completed Sep 9, 2012
@sobrinho
Copy link
Contributor Author

sobrinho commented Sep 9, 2012

Thanks @jnicklas :)

@dchelimsky
Copy link

@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
Copy link
Owner

jnicklas commented Oct 6, 2012

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants