Forum: Ruby on Rails Testing modules

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Greg L. (Guest)
on 2008-11-07 00:06
I'm curious about standards on unit testing modules.

I have a module file in my lib/ directory. Should I create a unit test
in test/unit directory and test it as I would any other model?

Is there any kind of naming convention used for unit test files for
modules (some_name_test.rb or some_name_module_test.rb)?
Daniel B. (Guest)
on 2008-11-07 03:33
(Received via mailing list)
On Nov 7, 9:06 am, Greg L. <removed_email_address@domain.invalid>
wrote:
> I'm curious about standards on unit testing modules.
>
> I have a module file in my lib/ directory. Should I create a unit test
> in test/unit directory and test it as I would any other model?

Don't know if there's a standard but I think it makes sense just to
test
it in test/unit.

> Is there any kind of naming convention used for unit test files for
> modules (some_name_test.rb or some_name_module_test.rb)?

Don't know.  If it's lib/some_name.rb then test/unit/
some_name_test.rb
seems ok with contents:
  require File.dirname(__FILE__) + '/../test_helper'
  class SomeNameTest < Test::Unit::TestCase
  ...
  end
Works for me at the moment.

--
Daniel B.
This topic is locked and can not be replied to.