From: Phlip Date: 2010-05-06T07:45:06+09:00 Subject: Re: What is the standard way to put a standard set of asserts into a called subroutine in test/unit? On Apr 30, 2:42 pm, Xeno Campanoli / Eskimo North and Gmail wrote: > I want to do something like: > > require 'test/unit' > > class TestMyStuff < Test::Unit::TestCase > >         def mysub(x,y) >                 assert_not_nil(x,"x nil") >                 assert_not_nil(y,"y nil") >                 assert(x == y,"messages") >         end Call it assert_mysub(). In general, generic assertions have mundane names, such as assert_equal, and application-specific assertions have long names that reveal their application-specific intent. Such as assert_x_and_y. Next, all tests use the pattern Assemble, Activate, Assert, but your test case might be missing its Activate line. The line that actually does something important, in your production code! That pattern is, generally, why I always call the assembly methods "assemble_", and I always call assertions "assert_". And, as always, props for writing developer tests. You are now among the top 5% of all programmers. (More's the pity!;) -- Phlip http://c2.com/cgi/wiki?ZeekLand