次のチュートリアルに従って、Rails アプリで PostGIS をセットアップしました: http://www.daniel-azuma.com/blog/archives/69
Guard でテストを実行しようとすると、次のエラーが発生します。
Exception encountered: #<ActiveRecord::StatementInvalid: PG::Error: ERROR: must be owner of relation spatial_ref_sys: ALTER TABLE "spatial_ref_sys" ENABLE TRIGGER ALL>
postgis スキーマの所有者を「通常の」データベース ユーザーに変更しました。テストでデータベースクリーナーも使用しています。
完全なバックトレースは次のとおりです。
/Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-mini-profiler-0.1.18/lib/patches/sql_patches.rb:155:in
exec' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-mini-profiler-0.1.18/lib/patches/sql_patches.rb:155:in
async_exec ' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:654:block in execute' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/abstract_adapter.rb:280:in
ブロック内log' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.7/lib/active_support/notifications/instrumenter.rb:20:ininstrument' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/abstract_adapter.rb:275:in
log ' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:653:inexecute' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:530:in
/Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:530 で確認します: indisable_referential_integrity' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/database_cleaner-0.8.0/lib/database_cleaner/active_record/truncation.rb:132:in
clean' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/database_cleaner-0.8.0/lib/database_cleaner/base.rb:39:inclean_with' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/database_cleaner-0.8.0/lib/database_cleaner/configuration.rb:62:in
ブロックインclean_with' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/database_cleaner-0.8.0/lib/database_cleaner/configuration.rb:62:ineach' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/database_cleaner-0.8.0/lib/database_cleaner/configuration.rb:62:in
clean_with' / Users/OyoKooN/Projects/sos_medecins/spec/spec_helper.rb:50:inblock (3 levels) in <top (required)>' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb:23:in
instance_eval' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core -2.11.1/lib/rspec/core/hooks.rb:23:inrun' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb:72:in
実行中のブロック' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb: 72:each' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb:72:in
実行中' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb :424:inrun_hook' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:27:in
block in run' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/ report.rb :34:report' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:25:in
実行中' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/test_framework/rspec .rb:11:inrun_tests' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:13:in
block in run' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/forker. rb:21:inblock in initialize' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/forker.rb:18:in
fork' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/forker.rb:18 :のinitialize' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:9:in
new' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:9:run' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/server.rb:48:in
実行中' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1548:perform_without_block' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1508:in
実行中' /Users/OyoKooN/.rbenv/versions/1.9.3- p194/lib/ruby/1.9.1/drb/drb.rb:1586:inblock (2 levels) in main_loop' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1582:in
loop' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb :1582:in `main_loop のブロック'
ありがとう。