Test environment

Installation

  1. Add a test database in your database.yml configuration file :
    test:
      adapter: sqlite3
      database: db/test.sqlite3
      pool: 5
      timeout: 5000
    
  2. Create your database with :
     ~foreman$ RAILS_ENV=test rake db:migrate 
  3. Run the all tests :
    ~foreman$ RAILS_ENV=test rake test
  4. Or a singe test :
    ~foreman/test$ RAILS_ENV=test ruby functional/your_test.rb 

Troubleshooting

  • If you have some errors like that :
     /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- rr (MissingSourceFile) 

    juste install missing gem. In that case :
    gem install rr

Also available in: HTML TXT