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

Development

Runtime

>= 0
 Project Readme

Lines of Code

Grumpy Old Man

Adding old school asserts to RSpec

GrumpyOldMan adds the following methods to RSpec without compromising any of RSpec's other features.

  • assert
  • assert_equal
  • assert_raise
  • refute

NOTE: If you're using rspec-rails, these methods are delegated to MiniTest and you don't need GrumpyOldMan.

Testing libraries exist to help you do the following.

  1. Execute some code
  2. Verify that it produced the expected outcome

Or more simply...

assert true

Unfortunately RSpec adds a lot of unnecessary complexity. Looking at you expectations and matchers.

Simplicity FTW

Consider the following example from the RSpec docs.

expect(order.total).to eq(Money.new(5.55, :USD))

Rewritten with GrumpyOldMan.

assert order.total == Money.new(5.55, :USD)

# or ...

assert_equal order.total, Money.new(5.55, :USD)

Simple asserts encourage test code that resembles your application logic.

Usage

bundle add grumpy_old_man

Simply include GrumpyOldMan in your spec/test like so.

require "grumpy_old_man"

describe Thing do
  include GrumpyOldMan

  it "should be simple" do
    assert true
    assert_equal true, true
    assert_raise(Exception) { raise }
    refute false
  end
end

You may not agree, but I'm sticking with my old fashioned assert. Now get off my lawn!

If you like GrupyOldMan, check out PryTest and discover just how serene testing can be.