Any special assertion to test if the resulting integer lies within a range
- by barerd
I would like to test if an instance variable lies in a range of numbers. I solved the problem by using assert_in_delta but would like to know if there is a formal assertion for this.
#part of the tested class
def initialize(value = 70 + rand(30))
@value = value
end
#test_value.rb
class ValueTestCase < Test::Unit::TestCase
def test_if_value_in_range
assert_in_delta(85, p.value, 15)
end
end