diff options
| -rw-r--r-- | INSTALL.md | 3 | ||||
| -rw-r--r-- | lib/tasks/init.rake | 4 | ||||
| -rw-r--r-- | lib/tasks/test_db.rake | 19 | ||||
| -rw-r--r-- | test/test_helper.rb | 6 |
4 files changed, 13 insertions, 19 deletions
| @@ -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 | ||
| 138 | production: | 141 | production: |
| 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 |
| 79 | end | 79 | end |
| 80 | |||
| 81 | Rake::Task["db:schema:load"].enhance do | ||
| 82 | Page.ensure_search_vector_trigger! | ||
| 83 | end | ||
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 @@ | |||
| 1 | namespace :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 | ||
| 19 | end | ||
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" | |||
| 2 | require File.expand_path(File.dirname(__FILE__) + "/../config/environment") | 2 | require File.expand_path(File.dirname(__FILE__) + "/../config/environment") |
| 3 | require 'rails/test_help' | 3 | require '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. | ||
| 9 | Page.ensure_search_vector_trigger! | ||
| 10 | |||
| 5 | module ActiveRecord | 11 | module ActiveRecord |
| 6 | class FixtureSet | 12 | class FixtureSet |
| 7 | class << self | 13 | class << self |
