Module: MiniTest

Defined in:
lib/minitest/should_syntax.rb,
lib/minitest/should_syntax/version.rb

Overview

Rspec-like matching for MiniTest.

Usage

# All objects get .should:
  obj.should == 2
  obj.should ~= /regex/
  obj.should != 3
  obj.should.be.true    # Truthy
  obj.should.be.false   # Falsy

# Anything else will just pass thru:
  obj.should.nil?     # same as: assert obj.nil?
  obj.should.be.nil?  # same as: assert obj.nil?
  obj.should.respond_to?(:freeze)

# You can also use should_not:
  obj.should_not == 3
  obj.should_not.be.nil?

# Errors and throws
  should.raise(Error) { lol }
  should.throw(:x) { lol }

# Messages
  msg "Age must be set properly"
  age.should == 18

Defined Under Namespace

Classes: ShouldSyntax, Unit