Commit 8e225cfc0282395c27a9db6902c74bf83a3c64d6

Authored by Dan Lawless
1 parent 69547d8f

fixing Cucumber World issue

Showing 1 changed file with 38 additions and 11 deletions   Show diff stats
features/support/env.rb
  1 +# IMPORTANT: This file was generated by Cucumber 0.4.2
  2 +# Edit at your own peril - it's recommended to regenerate this file
  3 +# in the future when you upgrade to a newer version of Cucumber.
  4 +# Consider adding your own code to a new file instead of editing this one.
  5 +
1 6 # Sets up the Rails environment for Cucumber
2 7 ENV["RAILS_ENV"] ||= "cucumber"
3 8 require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
4 9 require 'cucumber/rails/world'
5 10  
6   -# Comment out the next line if you don't want Cucumber Unicode support
7   -require 'cucumber/formatter/unicode'
  11 +# If you set this to true, each scenario will run in a database transaction.
  12 +# You can still turn off transactions on a per-scenario basis, simply tagging
  13 +# a feature or scenario with the @no-txn tag.
  14 +#
  15 +# If you set this to false, transactions will be off for all scenarios,
  16 +# regardless of whether you use @no-txn or not.
  17 +#
  18 +# Beware that turning transactions off will leave data in your database
  19 +# after each scenario, which can lead to hard-to-debug failures in
  20 +# subsequent scenarios. If you do this, we recommend you create a Before
  21 +# block that will explicitly put your database in a known state.
  22 +Cucumber::Rails::World.use_transactional_fixtures = true
8 23  
9   -# Comment out the next line if you don't want transactions to
10   -# open/roll back around each scenario
11   -Cucumber::Rails.use_transactional_fixtures
  24 +# If you set this to false, any error raised from within your app will bubble
  25 +# up to your step definition and out to cucumber unless you catch it somewhere
  26 +# on the way. You can make Rails rescue errors and render error pages on a
  27 +# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
  28 +#
  29 +# If you set this to true, Rails will rescue all errors and render error
  30 +# pages, more or less in the same way your application would behave in the
  31 +# default production environment. It's not recommended to do this for all
  32 +# of your scenarios, as this makes it hard to discover errors in your application.
  33 +ActionController::Base.allow_rescue = false
12 34  
13   -# Comment out the next line if you want Rails' own error handling
14   -# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
15   -Cucumber::Rails.bypass_rescue
  35 +require 'cucumber'
  36 +# Comment out the next line if you don't want Cucumber Unicode support
  37 +require 'cucumber/formatter/unicode'
  38 +require 'cucumber/webrat/element_locator' # Lets you do table.diff!(element_at('#my_table_or_dl_or_ul_or_ol').to_table)
16 39  
17 40 require 'webrat'
18   -
  41 +require 'webrat/core/matchers'
19 42 Webrat.configure do |config|
20 43 config.mode = :rails
  44 + config.open_error_files = false # Set to true if you want error pages to pop up in the browser
21 45 end
22 46  
23   -# require 'cucumber/rails/rspec'
24   -require 'webrat/core/matchers'
  47 +require 'factory_girl/step_definitions'
  48 +FakeWeb.allow_net_connect = false
  49 +
  50 +Dir[File.join(Rails.root, "test", "support", "**", "*.rb")].each { |file| require(file) }
  51 +
... ...