Created
April 29, 2009 15:22
-
-
Save tomtt/103840 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Sets up the Rails environment for Cucumber | |
| ENV["RAILS_ENV"] ||= "test" | |
| require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
| require 'cucumber/rails/world' | |
| require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support | |
| Cucumber::Rails.use_transactional_fixtures | |
| Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling | |
| # (e.g. rescue_action_in_public / rescue_responses / rescue_from) | |
| require 'webrat' | |
| Webrat.configure do |config| | |
| config.mode = :rails | |
| end | |
| require 'cucumber/rails/rspec' | |
| require 'webrat/core/matchers' | |
| require File.join(RAILS_ROOT, "spec", "factories") | |
| require File.join(RAILS_ROOT, "spec", "shared_helper") | |
| # This code added to allow us to use mocks in cucumber steps. This is not | |
| # recommended for standard usage, but there are cases when it can be useful. In | |
| # our case for removing the need for an image to have an actual image which | |
| # helps performance no end. | |
| require "spec/mocks" | |
| Before do | |
| $rspec_mocks ||= Spec::Mocks::Space.new | |
| end | |
| After do | |
| begin | |
| $rspec_mocks.verify_all | |
| ensure | |
| $rspec_mocks.reset_all | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment