No commit activity in last 3 years
No release in over 3 years
Assertions for Petitest.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 10.0

Runtime

>= 0.2.0
 Project Readme

Petitest::Assertions

Gem Version Documentation

Assertions for Petitest.

Installation

Add this line to your application's Gemfile:

gem "petitest-assertions"

And then execute:

bundle

Or install it yourself as:

gem install petitest-assertions

Usage

Setup

  1. Require "petitest/assertions"
  2. Include Petitest::Assertions into your test groups
require "petitest/autorun"
require "petitest/assertions"

class ExampleTest < Petitest::TestGroup
  include ::Petitest::Assertions

  # ... test cases ...
end

assert_equal

assert_equal(2, 1 + 1)

assert_match

assert_match(/foo/, "fooooo")

assert_operator

assert_operator(2, :>, 1)

assert_output

assert_output(/foo/, nil) do
  puts "fooooo"
end

assert_output(nil, /foo/) do
  $stdout.puts "fooooo"
end

assert_output(/foo/, /bar/) do
  puts "fooooo"
  $stdout.puts "barrrr"
end

assert_raise

assert_raise(::StandardError) do
  raise
end

assert_to_be

assert_to_be(:empty, [])

assert_to_have

assert_to_have(:key, :foo, foo: :bar)