I have a model "Collection" which has a constant PATH.
When in development or production mode, I want PATH == "data/images".
When in test mode, I want PATH == "data/test/images".
Here is my partial solution: The Collection class defines PATH so that
it points the default (non-test) location. In my test file
"collection_test.rb", I overrid that assignment like this:
class Collection < ActiveRecord::Base
PATH = "data/test/images"
end
For a reason I don''t understand, this only works when I alter the
Collection class right in my testcase file. It doesn''t work when I try
to alter it in the test helper. Having to repeat this PATH
redefinition in every test case file is not very DRY -- how can I have
this automatically happen for all my test cases?
I also get the ruby output "warning: already initialized constant
PATH" whenever I change it by redefining the constant. How do I change
the value of the constant without getting that warning?
cheers
Gerret