From 01aec09922231fc276acbd66f73dbf3b89f5dc3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20B=C3=B6ttger?= Date: Sat, 11 Jan 2014 12:12:29 +0100 Subject: [PATCH] don't load migrations more than once when running all specs (and surpressing migration output to improve readability) --- spec/database.rb | 33 +++++++++++++++++++++++++++++++++ spec/schema.rb | 35 ----------------------------------- spec/spec_helper.rb | 2 +- 3 files changed, 34 insertions(+), 36 deletions(-) create mode 100644 spec/database.rb delete mode 100644 spec/schema.rb diff --git a/spec/database.rb b/spec/database.rb new file mode 100644 index 0000000..2c38243 --- /dev/null +++ b/spec/database.rb @@ -0,0 +1,33 @@ +ActiveRecord::Migration.suppress_messages do + %w{gates readers writers transients simples simple_new_dsls no_scopes thieves localizer_test_models persisted_states provided_and_persisted_states}.each do |table_name| + ActiveRecord::Migration.create_table table_name, :force => true do |t| + t.string "aasm_state" + end + end + + ActiveRecord::Migration.create_table "validators", :force => true do |t| + t.string "name" + t.string "status" + end + + ActiveRecord::Migration.create_table "transactors", :force => true do |t| + t.string "name" + t.string "status" + t.integer "worker_id" + end + + ActiveRecord::Migration.create_table "workers", :force => true do |t| + t.string "name" + t.string "status" + end + + ActiveRecord::Migration.create_table "invalid_persistors", :force => true do |t| + t.string "name" + t.string "status" + end + + ActiveRecord::Migration.create_table "fathers", :force => true do |t| + t.string "aasm_state" + t.string "type" + end +end diff --git a/spec/schema.rb b/spec/schema.rb deleted file mode 100644 index d3854c6..0000000 --- a/spec/schema.rb +++ /dev/null @@ -1,35 +0,0 @@ -ActiveRecord::Schema.define(:version => 0) do - - %w{gates readers writers transients simples simple_new_dsls no_scopes thieves localizer_test_models persisted_states provided_and_persisted_states}.each do |table_name| - create_table table_name, :force => true do |t| - t.string "aasm_state" - end - end - - create_table "validators", :force => true do |t| - t.string "name" - t.string "status" - end - - create_table "transactors", :force => true do |t| - t.string "name" - t.string "status" - t.integer "worker_id" - end - - create_table "workers", :force => true do |t| - t.string "name" - t.string "status" - end - - create_table "invalid_persistors", :force => true do |t| - t.string "name" - t.string "status" - end - - create_table "fathers", :force => true do |t| - t.string "aasm_state" - t.string "type" - end - -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a82ec46..e09ae2c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,7 +16,7 @@ def load_schema config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml')) ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log") ActiveRecord::Base.establish_connection(config['sqlite3']) - load(File.dirname(__FILE__) + "/schema.rb") + require File.dirname(__FILE__) + "/database.rb" end # custom spec helpers