views:

422

answers:

1

I am trying to get the whole setup working with Autotest/Growl/Shoulda on my Mac to test a gem I'm working on for Authlogic. I've used RSpec in the past quite a bit but would like to switch to Shoulda.

This gem is going to work with Rails, but others gems I've made are just plain old ruby libraries with no dependencies on Rails modules. What's the recommended way to test rubygems?

ZenTest seems to be focused largely on Rails, as I have yet to find a gem that makes it so calling autotest automagically runs all my TestUnit tests no matter if I'm using Rails, Sinatra, or just making a gem.

Question is, what is your setup/workflow for running tests on gems you are building? Do you have any resources that would help me out?

Or a more specific, testable question: How do I run the test suite for Paperclip or Authlogic with Autotest?

I've been using these as resources so far:

Thanks so much. Want to make testing a core part of my workflow.

+1  A: 

Autotest (and ZenTest in general) isn't focused on Rails. Indeed, the rails code was extracted out into a separate gem. However it does, by default, expect the files in your project folder to adhere to a certain layout and file naming convention. For example:

.
|-- lib
|   `-- my_library.rb
`-- test
    |-- test_helper.rb
    `-- test_mylibrary.rb

I have just posted a small project that works with Shoulda and is testable with Autotest.

If you would like to deviate from these conventions (e.g by suffixing rather than prefixing "test" onto your test code file names) than you can provide a .autotest file that uses an API provided by autotest to use your own scheme. There's a pretty complete example in the RSpec project itself.

Simon
thanks for that example, it's becoming clearer :). I'm wondering, what are these guys (Authlogic author and Paperclip author, links to tests above) using to test their projects? Do they use autotest with custom discovery paths? What are your thoughts? Waiting for answers from the authors too.
viatropos