Functional test problem with environments variables

Hi guys,

i have been experiencing this problem once i put in some constant
declarations in /config/environments/development.rb. I declared it very
normally like this :

USER_DETAILS = {
:name => ‘abc’,
:password => ‘123’}

it works in the controller and when i run the application, i managed to
get the values out from the development.rb by using some statements like
@user = [‘USER_DETAILS’].name.

But when i code the functional test, even the most simple test like
test_index in user_controller_test, it failed and result in this error :
NameError: uninitialized constant USER_DETAILS

inside the test_index is like this:
class UserControllerTest < Test::Unit::TestCase
def setup
@user = User.new
end
def test_index
get :index
assert_response :success
end
end

Is there anything that went wrong? Is there any files i need to set to
tell rails to go to the config file to get the constant USER_DETAILS?
Thanks for any help anyone can provide.

On Feb 26, 2006, at 8:15 PM, bao lee wrote:

managed to
get the values out from the development.rb by using some statements
like
@user = [‘USER_DETAILS’].name.

But when i code the functional test, even the most simple test like
test_index in user_controller_test, it failed and result in this
error :
NameError: uninitialized constant USER_DETAILS

inside the test_index is like this:

Development and Test are different environments…

Put it in top level environment.rb


– Tom M.