No release in over a year
Extended assertions for Minitest
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 5.0
 Project Readme

Minitest::ExtendedAssertions

Gem Version Build Status Coverage Status Code Climate

Extended assertions for Minitest

Installation

Add this line to your application's Gemfile:

gem 'minitest-extended_assertions'

And then execute:

$ bundle

Or install it yourself as:

$ gem install minitest-extended_assertions

Usage

Add in minitest_helper

require 'minitest/extended_assertions'

Hash

expected = {a: 1, b: 2}
actual = {a: 2, b: 1}

assert_equal_hash expected, actual
actual.must_equal_hash expected

# [:a]
# Expected: 1
#   Actual: 2

# [:b]
# Expected: 2
#   Actual: 1

Array

expected = [1, 2, 3, 4]
actual = [1, 20, 3, 40]

assert_equal_array expected, actual
actual.must_equal_array expected

# [1]
# Expected: 2
#   Actual: 20

# [3]
# Expected: 4
#   Actual: 40

JSON

expected = '{"a": 1, "b": 2}'
actual = '{"a": 2, "b": 1}'

assert_equal_json expected, actual
actual.must_equal_json expected

# ["a"]
# Expected: 1
#   Actual: 2

# ["b"]
# Expected: 2
#   Actual: 1

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/gabynaiman/minitest-extended_assertions.

License

The gem is available as open source under the terms of the MIT License.