Sorry for bothering you again.
Meanwhile I understood, that the rake task 'db:test:prepare' is not
available for
datamapper.
I also learned from the description of rake db:automigrate:
# Perform destructive automigration of all repositories in the current
Rails.env

So I generated as workaround a little shell script
script/db_test_am:
#! /bin/bash
export RAILS_ENV=test
echo $RAILS_ENV
rake db:automigrate
This script does the job!

Anyway, I tried to do it with a rake task. I generated
lib/tasks/am.rake:
namespace :db do
  namespace :test do
    desc "automigrate in the test environment"
    task :am => :environment do
      Rails.env = 'test'
      puts "#{Rails.env}"
      Rake::Task['db:automigrate'].invoke
    end
  end
end

The execution brought another surprise:
MyMac:tree_dm kittekat$ echo $RAILS_ENV
development
MyMac:tree_dm kittekat$ rake db:test:am
(in /Users/kittekat/Documents/rails_projects/tree_dm)
test
[datamapper] Finished auto_migrate! for :default repository
'tree_dm_test'
MyMac:tree_dm kitteat$

This task auto_migrates the development-database!!! (in spite of the
fact, that the success message from db:automigrate indicates the
correct test-database)

Did I misunderstand something?

Best regards
Kittekat

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to