Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Don't waste time writing tests.
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
try
.gitignore
CHANGES.txt
LICENSE.txt
README.rdoc
Rakefile
VERSION.yml

README.rdoc

Tryouts v2.0 ALPHA

Don't waste your time writing tests.

NOTE: Tryouts syntax changed since 0.x. The old version is still available in the 0.8-FINAL branch.

Check out the screencast created by Alex Peuchert.

Basic syntax

## A very simple test
  1 + 1
#=> 2

## The test description can spread
## across multiple lines. The same
## is true for test definitions.
  a = 'foo' 
  b = 'bar'
  a + b
#=> 'foobar'

## A test will pass when its return
## value equals the expectation. 
  'foo'.class
#=> String

## The expectations are evaluated.
  1 + 1
#=> 1 + 1

## Here's an example of testing errors
  begin
    raise RuntimeError
  rescue RuntimeError
    :success
  end
#=> :success

For real world examples, see the Gibbler tryouts.

Setup / Cleanup

All code before the first test definition is assumed to be setup code. All code after the last definition is assumed to be cleanup code. Here is an example:

# This is called after all tests
require 'gibbler'
Gibbler.digest_type = Digest::SHA256

## A Symbol can gibbler
  :anything.gibbler
#=> '754f87ca720ec256633a286d9270d68478850b2abd7b0ae65021cb769ae70c08'

# This will be called after all tests
Gibbler.digest_type = Digest::SHA1

Running Tests

Try ships with a command-line tool called try. When called with no arguments, it will look for files ending with _try.rb in the current directory, or in the subfolder try.

You can also supply a specific file to test.

$ try path/2/test.rb

If all tests pass, try exits with a 0. Otherwise it exits with the number of tests that failed.

Installation

One of:

$ gem install tryouts

Credits

With help from:

Thanks

This collision was brought to you by Montreal.rb.

Something went wrong with that request. Please try again.