As in other rake tasks for Rails, just specify RAILS_ENV for the rake on the command line, for example.
rake db:mongoid:create_indexes RAILS_ENV=test
You can pin your log files in another window to see how this happens.
tail -f log/*.log
source
share