fun_with_testing

A bunch of useful assertions, and a subclass of Test::Unit::TestCase for my gems to derive from.

Usage:

# This might go in test/helper.rb, for example
class GemTestCase < Test::Unit::TestCase
  include FunWith::Testing              # includes all custom assertions
  # include FunWith::Testing::Assertions::Basics        # alternately, just include tests piecemeal
  # include FunWith::Testing::Assertions::ActiveRecord  # alternately, just include tests piecemeal
  # include FunWith::Testing::Assertions::FunWithFiles  # alternately, just include tests piecemeal
end

Then in test/test_gem.rb:

class TestGem < GemTestCase
  def test_my_thing
    assert_zero( 0 )
    assert_not_zero( 1 )
    assert_has_method( 1, :to_s )
    # ... and so on down the line
  end
end

In the FunWith gems, gem tests use a subclass of FunWith::Testing::TestCase, a subclass of Test::Unit::TestCase with some helpful methods.

#_should() : ignores the inner block, instead prints a message warning that the test is being skipped
#_context() : ignores the inner block, instead prints a message warning that the set of tests is being skipped.

Contributing to fun_with_testing

Copyright © 2014 Bryce Anderson. See LICENSE.txt for further details.