Sha256: 3932dfb5bafdeb6563c94ceecb1c5bd00aa2a76ead036c0a091af49391b7af3f
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
# Sets up the Rails environment for Cucumber ENV["RAILS_ENV"] ||= "cucumber" require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') #require 'cucumber/rails/world' # Comment out the next line if you don't want transactions to # open/roll back around each scenario # Cucumber::Rails.use_transactional_fixtures # Comment out the next line if you want Rails' own error handling # (e.g. rescue_action_in_public / rescue_responses / rescue_from) # Cucumber::Rails.bypass_rescue require 'test/unit/assertions' World(Test::Unit::Assertions) require 'rack/test' World(Rack::Test::Methods) $: << RAILS_ROOT + '/../../vendor/webrat/lib' require 'webrat' require 'webrat/rack_test' Webrat.configure do |config| config.mode = :rack_test end def app ActionController::Dispatcher.new end World(Webrat::Methods) World(Webrat::Matchers) Before do @__cucumber_ar_connection = ActiveRecord::Base.connection if @__cucumber_ar_connection.respond_to?(:increment_open_transactions) @__cucumber_ar_connection.increment_open_transactions else ActiveRecord::Base.__send__(:increment_open_transactions) end @__cucumber_ar_connection.begin_db_transaction ActionMailer::Base.deliveries = [] if defined?(ActionMailer::Base) Layout.create!(:name => "basic", :content => <<EOC) <r:content /> EOC User.create!(:name => "Administrator", :login => "admin", :password => "radiant", :password_confirmation => "radiant", :admin => true) end After do @__cucumber_ar_connection.rollback_db_transaction if @__cucumber_ar_connection.respond_to?(:decrement_open_transactions) @__cucumber_ar_connection.decrement_open_transactions else ActiveRecord::Base.__send__(:decrement_open_transactions) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
metry-1.2.0 | radiant/example/features/support/env.rb |