add support for in-memory testing
This commit is contained in:
parent
722bd7abe4
commit
3751f9b7e1
14
config/initializers/in_memory_testing.rb
Normal file
14
config/initializers/in_memory_testing.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
def in_memory_database?
|
||||||
|
if %w{test cucumber}.member? ENV['RAILS_ENV']
|
||||||
|
ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLite3Adapter and
|
||||||
|
Rails::Configuration.new.database_configuration[ENV['RAILS_ENV']]['database'] == ':memory:'
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if in_memory_database?
|
||||||
|
puts "creating sqlite in memory database"
|
||||||
|
load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
|
||||||
|
# ActiveRecord::Migrator.up('db/migrate') # use migrations
|
||||||
|
end
|
@ -76,8 +76,4 @@ ActiveRecord::Schema.define(:version => 20100316041234) do
|
|||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_foreign_key "projects", "users", :name => "projects_owner_id_fk", :column => "owner_id"
|
|
||||||
|
|
||||||
add_foreign_key "tasks", "users", :name => "tasks_owner_id_fk", :column => "owner_id"
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user