Forum: Ruby Verify-0.2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Robert D. (Guest)
on 2009-04-17 23:13
(Received via mailing list)
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 :).

http://rubyforge.org/frs/?group_id=3824&release_id=33500


* 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.

Examples:

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

 require 'stringio'
 out = StringIO::new
 x = with_output out do
   puts 42
 end
 verify do x == ["42"] end
 verify do out.string == "42\n" end
 x = with_output out do
   print "hello "
   puts "World"
 end
 verify do x == ["42", "hello World"] end
 verify do out.string == "42\nhello World\n" end
end
This topic is locked and can not be replied to.