Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On Ruby on Rails, how to run ONE functional test when another one is breaking?

let's say you added a controller and action (example: story/index), and want to run a functional test by

rake test:functionals

and then you found that another part of the project your coworker is working on actually broke the test at an earlier place (another controller/action), before your functional test takes place.

In this case, can you run just one functional test, which is yours?

like image 874
nonopolarity Avatar asked Jun 04 '10 21:06

nonopolarity


1 Answers

Wise-Ass Answer
If you coworker breaks the tests, then he should fix the test, or he shouldn't have committed the code to the repo. That is the main principle that we usually have in projects I work on.

Nice Answer
Try this

rake test:functionals TEST=test/functional/xy_test.rb

Or this
running one test without rake but with explicit $-loadpath works too here "ruby -I directory" specifies the $loadpath. Otherwise you won't load test environment and "require test_helper" fails!

ruby -I test test/functional/xy_test.rb
like image 148
Jonas Söderström Avatar answered Oct 21 '22 16:10

Jonas Söderström