Database is cleaned between scenarios. Progress?
This commit is contained in:
parent
4fec1bf717
commit
6f1aee990c
2 changed files with 18 additions and 17 deletions
|
|
@ -35,12 +35,4 @@ Diaspora::Application.configure do
|
||||||
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
# 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
|
# like if you have constraints or database-specific column types
|
||||||
# config.active_record.schema_format = :sql
|
# 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
|
end
|
||||||
|
|
|
||||||
|
|
@ -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
|
# 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
|
# prefer to use XPath just remove this line and adjust any selectors in your
|
||||||
# steps to use the XPath syntax.
|
# 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
|
# 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
|
# 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.
|
# of your scenarios, as this makes it hard to discover errors in your application.
|
||||||
ActionController::Base.allow_rescue = false
|
ActionController::Base.allow_rescue = false
|
||||||
|
|
||||||
# How to clean your database when transactions are turned off. See
|
require 'database_cleaner'
|
||||||
# http://github.com/bmabey/database_cleaner for more info.
|
require 'database_cleaner/cucumber'
|
||||||
begin
|
DatabaseCleaner.strategy = :transaction
|
||||||
require 'database_cleaner'
|
DatabaseCleaner.orm = "active_record"
|
||||||
require 'database_cleaner/cucumber'
|
Cucumber::Rails::World.use_transactional_fixtures = true
|
||||||
DatabaseCleaner.strategy = :truncation
|
|
||||||
DatabaseCleaner.orm = "active_record"
|
|
||||||
end
|
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), "..", "..", "spec", "helper_methods")
|
require File.join(File.dirname(__FILE__), "..", "..", "spec", "helper_methods")
|
||||||
include HelperMethods
|
include HelperMethods
|
||||||
|
|
||||||
|
Before do
|
||||||
|
DatabaseCleaner.start
|
||||||
|
end
|
||||||
|
|
||||||
|
After do
|
||||||
|
DatabaseCleaner.clean
|
||||||
|
end
|
||||||
|
|
||||||
module Resque
|
module Resque
|
||||||
def enqueue(klass, *args)
|
def enqueue(klass, *args)
|
||||||
klass.send(:perform, *args)
|
klass.send(:perform, *args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module Diaspora::WebSocket
|
module Diaspora::WebSocket
|
||||||
def self.redis
|
def self.redis
|
||||||
FakeRedis.new
|
FakeRedis.new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class FakeRedis
|
class FakeRedis
|
||||||
def rpop(*args)
|
def rpop(*args)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def llen(*args)
|
def llen(*args)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def lpush(*args)
|
def lpush(*args)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue