Merge pull request #100 from openSUSE/test_in_memory
Suggest/allow an in-memory db for testing.
This commit is contained in:
commit
b041edff52
2 changed files with 9 additions and 3 deletions
|
|
@ -14,7 +14,7 @@ development:
|
||||||
# Do not set this db to the same as development or production.
|
# Do not set this db to the same as development or production.
|
||||||
test:
|
test:
|
||||||
adapter: sqlite3
|
adapter: sqlite3
|
||||||
database: db/test.sqlite3
|
database: ":memory:"
|
||||||
pool: 5
|
pool: 5
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@ Coveralls.wear!('rails')
|
||||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
ENV["RAILS_ENV"] ||= 'test'
|
ENV["RAILS_ENV"] ||= 'test'
|
||||||
require File.expand_path("../../config/environment", __FILE__)
|
require File.expand_path("../../config/environment", __FILE__)
|
||||||
|
|
||||||
|
if Rails.configuration.database_configuration['test']['database'] == ':memory:'
|
||||||
|
load "#{Rails.root}/db/schema.rb"
|
||||||
|
load "#{Rails.root}/db/seeds.rb"
|
||||||
|
end
|
||||||
|
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
|
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||||
|
|
@ -39,9 +45,9 @@ RSpec.configure do |config|
|
||||||
|
|
||||||
# Include factory_girls syntax
|
# Include factory_girls syntax
|
||||||
config.include FactoryGirl::Syntax::Methods
|
config.include FactoryGirl::Syntax::Methods
|
||||||
|
|
||||||
# As we start from scratch in April 2014, let's forbid the old :should syntax
|
# As we start from scratch in April 2014, let's forbid the old :should syntax
|
||||||
config.expect_with :rspec do |c|
|
config.expect_with :rspec do |c|
|
||||||
c.syntax = :expect
|
c.syntax = :expect
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue