Skip to content
Browse files

updates for newer cucumber/cucumber-rails/aruba

  • Loading branch information...
1 parent 9358de8 commit b638fd0cd4b61a7b80a8e415bfd05b2f4fd267cc @jferris jferris committed with croaky
Showing with 46 additions and 3 deletions.
  1. +1 −1 features/integration.feature
  2. +6 −2 features/support/env.rb
  3. +39 −0 features/support/selectors.rb
View
2 features/integration.feature
@@ -13,7 +13,7 @@ Feature: integrate with application
And I add the "factory_girl_rails" gem
And I add the "database_cleaner" gem
And I add the "clearance" gem from this project
- And I add the "diesel" gem from git "git://github.com/thoughtbot/diesel.git" on branch "rails-3-1"
+ And I add the "diesel" gem from git "git://github.com/thoughtbot/diesel.git"
And I reset Bundler environment variable
And I run `bundle install --local`
And I successfully run `bundle exec rails generate cucumber:install`
View
8 features/support/env.rb
@@ -15,8 +15,12 @@
require 'diesel/testing'
require 'diesel/testing/integration'
-
-require 'cucumber/rails'
+require 'cucumber/rails3/application'
+require 'cucumber/rails3/action_controller'
+require 'rails/test_help'
+require 'cucumber/rails/world'
+require 'cucumber/rails/hooks'
+require 'cucumber/rails/capybara'
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# order to ease the transition to Capybara we set the default here. If you'd
View
39 features/support/selectors.rb
@@ -0,0 +1,39 @@
+module HtmlSelectorsHelpers
+ # Maps a name to a selector. Used primarily by the
+ #
+ # When /^(.+) within (.+)$/ do |step, scope|
+ #
+ # step definitions in web_steps.rb
+ #
+ def selector_for(locator)
+ case locator
+
+ when /the page/
+ "html > body"
+
+ # Add more mappings here.
+ # Here is an example that pulls values out of the Regexp:
+ #
+ # when /the (notice|error|info) flash/
+ # ".flash.#{$1}"
+
+ # You can also return an array to use a different selector
+ # type, like:
+ #
+ # when /the header/
+ # [:xpath, "//header"]
+
+ # This allows you to provide a quoted selector as the scope
+ # for "within" steps as was previously the default for the
+ # web steps:
+ when /"(.+)"/
+ $1
+
+ else
+ raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
+ "Now, go and add a mapping in #{__FILE__}"
+ end
+ end
+end
+
+World(HtmlSelectorsHelpers)

0 comments on commit b638fd0

Please sign in to comment.
Something went wrong with that request. Please try again.