0

I am trying to load the test environment for unit testing and used several commands like 1. RAILS_ENV = test 2. rails console test 3. RAILS_ENV=test rails console

I am getting the same error each time(undefined method 'symbolize keys').

Can someone let me know what to do to load the test environment ?

manish kumar
  • 21
  • 1
  • 3
  • `rails console test` is correct. Have a look at your `database.yml` file; this type of error can occur with a yaml syntax error. –  Sep 04 '13 at 09:08

1 Answers1

0

If you are using automated testing, your test environment will be loaded automatically. If you want to switch to the test environment in your console:

rails console test

The error you get is telling me there is something wrong in your code.

Miotsu
  • 1,776
  • 18
  • 30
  • Hi Miotsu, Its not automated testing and I am trying to switch test environment. I have already used the command which is mentioned but still it showing error.How can wrong code will affect in changing the environment ? Can you please explain about this. I am just trying to change the environment thats all – manish kumar Sep 04 '13 at 09:15
  • different environments have different settings, which can be set in database.yml and confi/environments/ . something might work in one environment and not in the other. – Miotsu Sep 04 '13 at 09:43
  • You are referring to database.yml code and I thought of my project code, oh gosh !!!! Anyhow the database.yml is fine and I got the solution by some googling and trial and hit bcos it always works. Thanks !!! – manish kumar Sep 04 '13 at 11:40
  • Suggestion: Please post the resolution so that future users will be able to find not only the question but the answer. Thanks. – Richard_G Sep 05 '13 at 01:33
  • RAILS_ENV=test rake db:create, this helps me in changing the environment and creating the database for my unit test – manish kumar Sep 05 '13 at 05:07