Test environment¶
Installation¶
- Add a test database in your database.yml configuration file :
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
- Create your database with :
~foreman$ RAILS_ENV=test rake db:migrate
- Run the all tests :
~foreman$ RAILS_ENV=test rake test
- Or a singe test :
~foreman/test$ RAILS_ENV=test ruby functional/your_test.rb
Troubleshooting¶
- If you get this kind of errors when running functional tests:
test_should_not_remove_the_anonymous_role(UsersControllerTest):
ActionController::RoutingError: No route matches {:controller=>"users", :commit=>"Submit", :id=>980190963, :action=>"update", :user=>{:login=>"johnsmith"}}
test/functional/users_controller_test.rb:32:in `test_should_not_remove_the_anonymous_role'
it means you need to set `:login: true` in the `config/settings.yaml` file.
Also available in:
HTML
TXT