summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL.md3
-rw-r--r--lib/tasks/init.rake4
-rw-r--r--lib/tasks/test_db.rake19
-rw-r--r--test/test_helper.rb6
4 files changed, 13 insertions, 19 deletions
diff --git a/INSTALL.md b/INSTALL.md
index cad9c9e1..55bf768c 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -134,6 +134,9 @@ test:
134 database: psql_test 134 database: psql_test
135 username: rails 135 username: rails
136 password: 136 password:
137 collation: en_US.UTF-8
138 ctype: en_US.UTF-8
139 template: template0
137 140
138production: 141production:
139 adapter: postgresql 142 adapter: postgresql
diff --git a/lib/tasks/init.rake b/lib/tasks/init.rake
index 16575345..adfaddfd 100644
--- a/lib/tasks/init.rake
+++ b/lib/tasks/init.rake
@@ -77,3 +77,7 @@ namespace :cccms do
77 end 77 end
78 end 78 end
79end 79end
80
81Rake::Task["db:schema:load"].enhance do
82 Page.ensure_search_vector_trigger!
83end
diff --git a/lib/tasks/test_db.rake b/lib/tasks/test_db.rake
deleted file mode 100644
index 0a7a17d7..00000000
--- a/lib/tasks/test_db.rake
+++ /dev/null
@@ -1,19 +0,0 @@
1namespace :db do
2 namespace :test do
3 task :load_schema do
4 ActiveRecord::Base.establish_connection(:test)
5 ActiveRecord::Schema.verbose = false
6 load "#{Rails.root}/db/schema.rb"
7 end
8
9 task :prepare => :environment do
10 begin
11 ActiveRecord::Base.establish_connection(:test)
12 ActiveRecord::Base.connection
13 rescue
14 system("psql -U postgres postgres -c \"CREATE DATABASE psql_test OWNER psql ENCODING 'UTF8';\"")
15 end
16 Rake::Task['db:test:load_schema'].invoke
17 end
18 end
19end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 7ab9c8c9..b7fe2b58 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -2,6 +2,12 @@ ENV["RAILS_ENV"] = "test"
2require File.expand_path(File.dirname(__FILE__) + "/../config/environment") 2require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3require 'rails/test_help' 3require 'rails/test_help'
4 4
5# rails/test_help calls maintain_test_schema!, which reloads db/schema.rb
6# in this process when a migration is pending. That recreates
7# page_translations and drops the search_vector trigger the initializer
8# installed at boot. Reinstall it here, after any such reload.
9Page.ensure_search_vector_trigger!
10
5module ActiveRecord 11module ActiveRecord
6 class FixtureSet 12 class FixtureSet
7 class << self 13 class << self