Database is cleaned between scenarios. Progress?

This commit is contained in:
Sarah Mei 2010-12-28 20:03:58 -08:00
parent 4fec1bf717
commit 6f1aee990c
2 changed files with 18 additions and 17 deletions

View file

@ -35,12 +35,4 @@ Diaspora::Application.configure do
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
begin
require 'database_cleaner'
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.orm = "active_record"
rescue LoadError => ignore_if_database_cleaner_not_present
puts "Error on cleaner"
end
end

View file

@ -20,7 +20,7 @@ require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links wi
# order to ease the transition to Capybara we set the default here. If you'd
# prefer to use XPath just remove this line and adjust any selectors in your
# steps to use the XPath syntax.
Capybara.default_selector = :css
Capybara.default_selector = :css
# If you set this to false, any error raised from within your app will bubble
# up to your step definition and out to cucumber unless you catch it somewhere
@ -33,35 +33,44 @@ Capybara.default_selector = :css
# of your scenarios, as this makes it hard to discover errors in your application.
ActionController::Base.allow_rescue = false
# How to clean your database when transactions are turned off. See
# http://github.com/bmabey/database_cleaner for more info.
begin
require 'database_cleaner'
require 'database_cleaner/cucumber'
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = "active_record"
end
require 'database_cleaner'
require 'database_cleaner/cucumber'
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.orm = "active_record"
Cucumber::Rails::World.use_transactional_fixtures = true
require File.join(File.dirname(__FILE__), "..", "..", "spec", "helper_methods")
include HelperMethods
Before do
DatabaseCleaner.start
end
After do
DatabaseCleaner.clean
end
module Resque
def enqueue(klass, *args)
klass.send(:perform, *args)
end
end
module Diaspora::WebSocket
def self.redis
FakeRedis.new
end
end
class FakeRedis
def rpop(*args)
true
end
def llen(*args)
true
end
def lpush(*args)
true
end