public
Description: Simple depth first ruby testing
Homepage:
Clone URL: git://github.com/geemus/shindo.git
shindo /
name age message
file .document Sat Oct 03 14:35:10 -0700 2009 Initial commit to shindo. [geemus]
file .gitignore Sat Oct 03 14:35:10 -0700 2009 Initial commit to shindo. [geemus]
file README.rdoc Mon Nov 02 22:48:14 -0800 2009 establish _tests.rb convention [geemus]
file Rakefile Mon Nov 02 22:52:31 -0800 2009 update tests directory/names and rakefile to ma... [geemus]
file VERSION Tue Nov 03 20:40:54 -0800 2009 Version bump to 0.0.4 [geemus]
directory bin/ Mon Nov 02 22:48:14 -0800 2009 establish _tests.rb convention [geemus]
directory lib/ Tue Nov 03 20:40:25 -0800 2009 fix tags for serious [geemus]
file shindo.gemspec Tue Nov 03 20:40:54 -0800 2009 Version bump to 0.0.4 [geemus]
directory tests/ Mon Nov 02 23:14:18 -0800 2009 split out tag tests and test by checking consol... [geemus]
README.rdoc

shindo

Simple depth first ruby testing, watch and learn.

Writing tests

There are two commands you should know, ‘tests’ and ‘test’. Tests help you group similar calls to test, but their return value is ignored. The return value of test, on the other hand, determines success or failure.

A successful test should return true. (yay)

  Shindo.tests do
    test('something really important') { true }
  end

A failing test should return false or nil. (boo)

  Shindo.tests do
    test('something (hopefully) less important') { false }
  end

A pending test shouldn’t even have a block (meh)

  Shindo.tests do
    test('something that hasn't been gotten around to yet')
  end

Grouping tests

  Shindo.tests do
    tests('foo/bar') do
      test('foo') { true }
      test('bar') { true }
    end
  end

You can also have descriptions for Shindo.tests, and write that last one like this

  Shindo.tests('foo/bar') do
    test('foo') { true }
    test('bar') { false }
  end

Nest tests as deeply as you would like.

Then, if you want to get real fancy you can also tag your tests, to help narrow down which ones to run

  Shindo.tests do
    tests('foo/bar', ['foo', 'bar']) do
      test('foo') { true }
      test('bar') { true }
    end
  end

Or if you can narrow down even more tightly

  Shindo.tests do
    tests('foo/bar') do
      test('foo', ['foo']) { true }
      test('bar', ['bar']) { true }
    end
  end

Running tests

Run tests with the shindo command, the easiest is to specify a file name:

  shindo something_tests.rb

You can also give directories and it will run all files ending in _tests.rb (recurses through subdirectories)

  shindo some_test_directory

That leaves tags, which use +/-. So run just tests with the ‘foo’ tag:

  shindo some_test_directory +foo

Or those without the ‘bar’ tag:

  shindo some_test_directory -bar

Or combine to run everything with a foo tag, but no bar tag

  shindo some_test_directory +foo -bar

Command line tools

When tests fail you’ll get lots of options to help you debug the problem, just enter ’?’ at the prompt to see your options.

Copyright

(The MIT License)

Copyright © 2009 geemus (Wesley Beary)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.