How does the "test:functionals" rake task work? I've had some strangeness as of late where seemingly unrelated modules and classes were clashing when I run "rake test:functionals", but not when running individual tests.
James
How does the "test:functionals" rake task work? I've had some strangeness as of late where seemingly unrelated modules and classes were clashing when I run "rake test:functionals", but not when running individual tests.
James
To answer the latter part of the question, the main difference is that in one case everything all the tests are loaded in one go (which pulls in all the controller classes) and then run, but in the other case not. One of the things that can break tests in this way is when a test modifies the environment in a way that isn't rolled back by the teardown. Depending on what it is your changing, the order in which tests run etc... this can mean a test is ok on its own or when an individual test suite is run, but not when all tests are run. So for example, setting class variables isn't rolled back i.e. the test
def test_record_timestamps ActiveRecord::Base.record_timestamps = false f = Foo.create assert_nil f.created_at end
will cause big problems, because record timestamps will be off for all subsequent tests.
Fred