Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [Ann] Verify-0.2

Thread Tools

[Ann] Verify-0.2

Robert Dober
Posts: n/a
Hi list

this is a bug fix of verify-0.1a introducing mockify.
It adheres to the basic principles to be very, very simple.
Hopefully it is useful to somebody, well it is to me .

* Backtrace information for unexpected exceptions fixed.
* Mockify tool added.
* Using verify and mockify for testing verify and mockify.

By requiring mockify the with_output method becomes available inside
Verify blocks.

The result of with_output calls is $stdout.readlines, but a stringio object can
be specified in addition to capture the output.


Verify "Mockify" do
x = with_output do
puts 42
verify do x == ["42"] end

require 'stringio'
out = StringIO::new
x = with_output out do
puts 42
verify do x == ["42"] end
verify do out.string == "42\n" end
x = with_output out do
print "hello "
puts "World"
verify do x == ["42", "hello World"] end
verify do out.string == "42\nhello World\n" end

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off