I'm somewhat new to RoR and I've found that along with my main RoR
development work I've also developed a number of custom rake tasks
that do various things.  I'd like to be able to write unit tests for
these rake tasks and I've done a fair bit of google but I haven't
really seen it explained well how to go about doing that.  The typical
advice is to develop your task as a class to test the class, but how
exactly is that done?  I've developed my latest task as a class, and
added the following code to test/unit:

class MyClassTest < Test::Unit::TestCase
  def test_is_day_word
    assert MyClassTest.is_day_word("Tuesday")
  end
end

However this throws:

  1) Error:
test_is_day_word(MyClassTest):
NameError: uninitialized constant MyClassTest::MyClass
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/
active_support/dependencies.rb:492:in `const_missing'
    ./test/unit/masstimes_crawl_test.rb:4:in `test_is_day_word'
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/
active_support/testing/setup_and_teardown.rb:33:in `__send__'
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/
active_support/testing/setup_and_teardown.rb:33:in `run'


What am I doing wrong and is there a better way to test rake tasks?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to