Sha256: 42c54d1399acf7b32d12385f8ac3d6b8144835f73b71326e06cd262b814a362c

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

if defined?(ActiveRecord::Base)
  Before do
    $__cucumber_global_use_txn = !!Cucumber::Rails::World.use_transactional_fixtures if $__cucumber_global_use_txn.nil?
  end

  Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
    Cucumber::Rails::World.use_transactional_fixtures = $__cucumber_global_use_txn
  end

  Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
    Cucumber::Rails::World.use_transactional_fixtures = false
  end

  Before do
    if Cucumber::Rails::World.use_transactional_fixtures
      run_callbacks :setup if respond_to?(:run_callbacks)
    else
      DatabaseCleaner.start
    end
    ActionMailer::Base.deliveries = [] if defined?(ActionMailer::Base)
  end

  After do
    if Cucumber::Rails::World.use_transactional_fixtures
      run_callbacks :teardown if respond_to?(:run_callbacks)
    else
      DatabaseCleaner.clean
    end
  end
else
  module Cucumber::Rails
    def World.fixture_table_names; []; end # Workaround for projects that don't use ActiveRecord
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
cucumber-rails2-0.3.5 lib/cucumber/rails/active_record.rb
cucumber-rails2-0.3.4 lib/cucumber/rails/active_record.rb
cucumber-rails2-0.3.3 lib/cucumber/rails/active_record.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/cucumber-rails-0.3.2/lib/cucumber/rails/active_record.rb
cucumber-rails-0.3.2 lib/cucumber/rails/active_record.rb
cucumber-rails-0.3.1 lib/cucumber/rails/active_record.rb
cucumber-rails-0.3.0 lib/cucumber/rails/active_record.rb
cucumber-rails-0.2.4 lib/cucumber/rails/active_record.rb