Topic: Want to load test database from custom schema

I created a custom rake task that will load an Oracle database with custom DDL statements.  How would I integrate this into the rspec.rake?The way I am doing this works, but it seems these tasks are being invoked from other rake tasks.Within the rspec.rake I have this:Rake::Task['db:test:purge'].invokeRake::Task['local:db:test:prepare'].invokeThe following is in a databases.rakenamespace :local do  namespace :db do    namespace :test do    desc

Re: Want to load test database from custom schema

Let me format this better:

Code in the rspec.rake

Rake::Task['db:test:purge'].invoke
Rake::Task['local:db:test:prepare'].invoke

Code in the databases.rake in my lib/tasks

require 'active_record'

namespace :local do
  namespace :db do
    namespace :test do
    desc "Load the test database from a SQL file"
      task :prepare => "db:load_config" do
        config = ActiveRecord::Base.configurations["test"]

        
        command = "sqlplus xx/xxxs@xxxxx @db/custom_structure.sql"
        puts "Running: #{command}"
        system command
      end
    end
  end
end

Last edited by TerpsFan (2011-06-07 10:05:59)

Re: Want to load test database from custom schema

The problem is that

Rake::Task['db:test:purge'].invoke
Rake::Task['local:db:test:prepare'].invoke

interferes with the db:migrate and db:seed rake tasks.  But not sure why these tasks would be invoking something in rspec.rake anyway.

Thanks for any guidance.