On Oct 9, 4:10 am, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> Are you getting hoodwinked by the fact that the development environmentis
> loaded once in order to dump its database (and then the
> testenvironmentloads) ?
>
> Fred
Hi Fred. I seem to have run into this problem again. I'll outline my
exact steps for you:
1) Create a new Rails app.
$ rails test_plugin_env
$ cd test_plugin_env
2) Create a new plugin.
$ script/generate plugin Foobar
3) Add the following to vendor/plugins/foobar/init.rb
if defined? RAILS_ENV
puts "foobar > init.rb > RAILS_ENV = [#{RAILS_ENV}]"
puts "foobar > init.rb > test environment!" if RAILS_ENV == 'test'
end
If you then run whatever tests exists in an empty Rails app, you'll
see that RAILS_ENV is never set to "test". For example:
$ rake test
(in /Users/nick/src/test_plugin_env)
foobar > init.rb > RAILS_ENV = [development]
/opt/local/bin/ruby -Ilib:test "/opt/local/lib/ruby/gems/1.8/gems/
rake-0.8.1/lib/rake/rake_test_loader.rb"
/opt/local/bin/ruby -Ilib:test "/opt/local/lib/ruby/gems/1.8/gems/
rake-0.8.1/lib/rake/rake_test_loader.rb"
/opt/local/bin/ruby -Ilib:test "/opt/local/lib/ruby/gems/1.8/gems/
rake-0.8.1/lib/rake/rake_test_loader.rb"
$
Why is RAILS_ENV never set to "test"?
Thanks again, Fred!
-Nick
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---