Module: Lab419

Defined in:
lib/verify.rb,
lib/mockify.rb

Overview

– *

  • Lab419, The Ruby For 1.9 Labratory, or Labrador for 1.9

*

  • Distributed under the terms of the BSD License.

  • Copyright © 2007, 2008, 2009 Robert Dober

  • All rights reserved.

*

  • Redistribution and use in source and binary forms, with or without

  • modification, are permitted provided that the following conditions are met:

    • Redistributions of source code must retain the above copyright

  • notice, this list of conditions and the following disclaimer.

    • Redistributions in binary form must reproduce the above copyright

  • notice, this list of conditions and the following disclaimer in the

  • documentation and/or other materials provided with the distribution.

    • Neither the name of the Labrador packahe nor the

  • names of its contributors may be used to endorse or promote products

  • derived from this software without specific prior written permission.

*

  • THIS SOFTWARE IS PROVIDED BY Robert Dober “AS IS” AND ANY

  • EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED

  • WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE

  • DISCLAIMED. IN NO EVENT SHALL Robert Dober BE LIABLE FOR ANY

  • DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES

  • (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;

  • LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND

  • ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT

  • (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS

  • SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

++

The Verify tool is a KISS verification and test tool, it is inspired by Ara T. Howard’s testy.rb. Ara however has still implemented a BDD framework, the purpose of Verify is to provide a Ruby Programmer with a very simple yet effective tool to test her assumptions about code.

Verify was motivated by the remark of Phlip who made an excellent point about assert. The Verify tool tries to implement exactly that idea.

Verify has the following goals

* Almost nothing to learn, one wrapper method and three test methods
   # At the end a resume of the verifications with an error message for each failed verification
   # will be printed to stderr.
   Verify optional_message do
      # All verifications to be reported go here and can have one of the following forms
      verify optional_message, &blk
      # verify that blk[] returns a true value
      verify_not optional_message, &blk
      # verify that vlk[] does not return a true value
      verify_exceptions *exceptions, &blk
      # verify that one exception of the list passed to the method is raised by blk[]
   end

* No metaprogramming, no at_exit hook, execution of the verification inside a wrapper object, no global namespace pollution,
  except the Verify method. 

* Very simple output

Defined Under Namespace

Modules: Mockify, Verify