On 13 Jan 2008, at 00:41, James H. wrote:
>
> 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.
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---