On Wed, Jun 24, 2009 at 10:53 PM, Ryan D.[email protected]
wrote:
This is only a maintenance release I did not want to advertise my tiny
package too much.
I just have no time to update my Rubyforge project homepage, but there
is a short description http://labrador.rubyforge.org/
Here is the README
This is the very simple Verify mini test framework
It emphasises on being able to check things out quickly without having
to load a heavy test
framework.
It evolves around my needs but for the time being it is pretty
lightweight.
require âverifyâ
Verify âSome Important Factsâ do
verify â42 is trueâ do
42
end
refute â42 is pretty bigâ do
42 > 100_000
end
verify_exceptions NoMethodError do
42.unrelinguished!
end
end
These forms are very easy to remember, but sometimes one needs to see
where the
errors, are, in order to achieve that one can use the parameter form
Verify âWith parametersâ do
verify msg: âEverything is wellâ, target: 42, actual: 21 * 2
refute msg: âBut not too muchâ, target: 42, actual: 41
end
Mockify allows to capture stdout or simulate stdin, all you need to do
is to
require âmockifyâ before requiring âverifyâ and than you can provide
stdin
and get stdout
Verify âProviding stdinâ do
with_input %w{The Quick Brown Fox} do
verify %{first line is âTheâ} do
âTheâ == gets.chomp
end
end
end
Verify âCapturing stdoutâ do
out = with_output do | o |
puts 42
verify target: â42\nâ, actual: o.string
end
end
verify msg: âwith_output converted out to an array of linesâ,
actual: out.map( &:chomp ),
target: %w{ 42 }
end
Enjoy
â
Toutes les grandes personnes ont dâabord Ă©tĂ© des enfants, mais peu
dâentre elles sâen souviennent.
All adults have been children first, but not many remember.
[Antoine de Saint-Exupéry]