Sha256: 132eac190174b308280f5d34d779a12968e1ee8de353bdeff440d28a5d72e427

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 Bytes

Contents

require 'test/unit'

class Test::Unit::TestCase

  def assert_difference(object, method = nil, difference = 1)
    initial_value = object.send(method)
    yield
    assert_equal initial_value + difference, object.send(method), "#{object}##{method}"
  end

  def assert_no_difference(object, method, &block)
    assert_difference object, method, 0, &block
  end

  class << self
    def should(behave,&block)
      method_name = "test_should_#{behave.gsub(' ', '_')}"
      if block
        define_method method_name, &block
      else
        puts ">>> Untested: #{name.sub(/Test$/,'')} should #{behave}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bloggit-1.0.3 test/helpers.rb
bloggit-1.0.7 test/helpers.rb