tests: extract common formula helper

This commit is contained in:
Jack Nagel 2013-05-25 17:19:18 -05:00
parent f0008a7e8f
commit 4adecd73b6
3 changed files with 6 additions and 8 deletions

View File

@ -2,10 +2,6 @@ require 'testing_env'
require 'formula'
class FormulaSpecSelectionTests < Test::Unit::TestCase
def formula(*args, &block)
@_f = Class.new(Formula, &block).new(*args)
end
def assert_spec_selected(spec)
assert_equal @_f.send(spec), @_f.active_spec
end

View File

@ -2,10 +2,6 @@ require 'testing_env'
require 'formula'
class FormulaValidationTests < Test::Unit::TestCase
def formula(*args, &block)
Class.new(Formula, &block).new(*args)
end
def assert_invalid(attr, &block)
e = assert_raises(FormulaValidationError, &block)
assert_equal attr, e.attr

View File

@ -106,3 +106,9 @@ module Test::Unit::Assertions
assert(obj.empty?, msg)
end if RUBY_VERSION.to_f <= 1.8
end
class Test::Unit::TestCase
def formula(*args, &block)
@_f = Class.new(Formula, &block).new(*args)
end
end