I got it working by adding the environment variable and running
rake test:units RAILS_ENV=test
So actually rails was accessing the wrong database.
質問
I have a problem with my unit tests in rails and found no idea how to solve it.
If i run rake test:units i get the following error:
rake aborted!
OCIError: ORA-01031: insufficient privileges: CREATE TABLE
"SCHEMA MIGRATIONS" ("VERSION" VARCHAR(255) NOT NULL)
stmt.c:312:in oci8lib_191.so
Tasks: TOP => test:units => test:prepare => db:test:prepare => db:abort_if_pedning_migrations
My current Gemfile is
source 'http://rubygems.org'
gem 'rails', '~> 3.1.12'
gem 'ruby-oci8', '~> 2.0.4'
gem 'activerecord-oracle_enhanced-adapter', '~> 1.3.2'
gem 'ruby-plsql', '~> 0.4.3'
gem 'sqlite3'
gem 'thin'
group :assets do
gem 'sass-rails', '~> 3.1.7'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
database.yml contains the following data:
test:
adapter: oracle_enhanced
database: service_name
username: db_admin
password: test
host: name_of_host
port: 1531
The same data as in database.yml works for the database connection in oracle sql developer.
解決
I got it working by adding the environment variable and running
rake test:units RAILS_ENV=test
So actually rails was accessing the wrong database.