tests: extract common formula helper
This commit is contained in:
parent
f0008a7e8f
commit
4adecd73b6
@ -2,10 +2,6 @@ require 'testing_env'
|
|||||||
require 'formula'
|
require 'formula'
|
||||||
|
|
||||||
class FormulaSpecSelectionTests < Test::Unit::TestCase
|
class FormulaSpecSelectionTests < Test::Unit::TestCase
|
||||||
def formula(*args, &block)
|
|
||||||
@_f = Class.new(Formula, &block).new(*args)
|
|
||||||
end
|
|
||||||
|
|
||||||
def assert_spec_selected(spec)
|
def assert_spec_selected(spec)
|
||||||
assert_equal @_f.send(spec), @_f.active_spec
|
assert_equal @_f.send(spec), @_f.active_spec
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,10 +2,6 @@ require 'testing_env'
|
|||||||
require 'formula'
|
require 'formula'
|
||||||
|
|
||||||
class FormulaValidationTests < Test::Unit::TestCase
|
class FormulaValidationTests < Test::Unit::TestCase
|
||||||
def formula(*args, &block)
|
|
||||||
Class.new(Formula, &block).new(*args)
|
|
||||||
end
|
|
||||||
|
|
||||||
def assert_invalid(attr, &block)
|
def assert_invalid(attr, &block)
|
||||||
e = assert_raises(FormulaValidationError, &block)
|
e = assert_raises(FormulaValidationError, &block)
|
||||||
assert_equal attr, e.attr
|
assert_equal attr, e.attr
|
||||||
|
|||||||
@ -106,3 +106,9 @@ module Test::Unit::Assertions
|
|||||||
assert(obj.empty?, msg)
|
assert(obj.empty?, msg)
|
||||||
end if RUBY_VERSION.to_f <= 1.8
|
end if RUBY_VERSION.to_f <= 1.8
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Test::Unit::TestCase
|
||||||
|
def formula(*args, &block)
|
||||||
|
@_f = Class.new(Formula, &block).new(*args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user