From: Matthew Kerwin Date: 2012-09-07T22:19:40+09:00 Subject: Re: assert All lines You could AND them together. 1==1 and 2==3 and 3==3 => false On 7 September 2012 22:43, Mario Ruiz wrote: > Hi, > I'm trying to create a method to assert all lines and if any of them > fail then the whole block will fail > require 'test/unit' > > def assert_all(message="assert_block failed.") # :yields: > _wrap_assertion do > if (!yield) > puts "ERROR" > raise Test::Unit::AssertionFailedError.new(message.to_s) > else > puts "PERFECT" > end > end > end > > class MyTest < Test::Unit::TestCase > def test01 > assert_all { > 1==1 > 2==3 > 3==3 > } > end > end > > > But it seems like it is not giving an error in this case > > -- > Posted via http://www.ruby-forum.com/. > -- Matthew Kerwin, B.Sc (CompSci) (Hons) http://matthew.kerwin.net.au/ ABN: 59-013-727-651 "You'll never find a programming language that frees you from the burden of clarifying your ideas." - xkcd