How to configure schema_search_path in the test environment?

Asked

Viewed 60 times

2

When I run the rake spec --trace command I have the error below. It seems to me that rake does not create the schema I want in the test environment by not identifying my schema configuration in database.yml. I have been researching and I saw that I can do an automated task to create the schema before creating the tables, but I kept thinking that this must be a common problem for many people. Why is rake not reading my settings in the schema_search_path database.yml? I believe that there must be a correct and easier way to do this. Any idea

DATABASE.YML

test:
  adapter: postgresql
  encoding: unicode
  database: sist_teste
  schema_search_path: adm_sist
  username: postgres
  password: postgres
  host: localhost

ERROR:

rake spec --trace
** Invoke spec (first_time)
** Invoke spec:prepare (first_time)
** Execute spec:prepare
** Invoke test:prepare (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment 
** Invoke db:load_config 
** Execute db:test:purge
** Execute db:test:load
** Invoke db:test:load_schema (first_time)
** Invoke db:test:purge 
** Execute db:test:load_schema
** Invoke db:schema:load (first_time)
** Invoke environment 
** Invoke db:load_config 
** Execute db:schema:load
rake aborted!
ActiveRecord::StatementInvalid: PG::InvalidParameterValue: ERROR:  invalid value for parameter "search_path": "adm_sist"
DETAIL:  schema "adm_sist" does not exist
: SET search_path TO adm_sist
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.