Module: GrumpyOldMan
- Defined in:
- lib/grumpy_old_man.rb,
lib/grumpy_old_man/version.rb
Overview
A mixin for RSpec tests that provides old school assert methods.
Constant Summary collapse
- VERSION =
"0.1.6"
Instance Method Summary collapse
-
#assert(arg = nil) ⇒ Object
A simple assert for RSpec.
-
#assert_equal(actual, expected) ⇒ Object
A basic assert helper that tests for Object equality.
-
#assert_raise(ex, &block) ⇒ Object
A basic assert helper that ensures an Error was raised.
-
#refute(arg = nil) ⇒ Object
A simple refute for RSpec.
Instance Method Details
#assert(arg = nil) ⇒ Object
A simple assert for RSpec.
16 17 18 19 |
# File 'lib/grumpy_old_man.rb', line 16 def assert(arg = nil) arg = yield if block_given? assert_equal !!arg, true end |
#assert_equal(actual, expected) ⇒ Object
A basic assert helper that tests for Object equality. Tests for object equivalence rather than object identity since this is sufficient for most tests.
40 41 42 |
# File 'lib/grumpy_old_man.rb', line 40 def assert_equal(actual, expected) expect(actual).to eql(expected) end |
#assert_raise(ex, &block) ⇒ Object
A basic assert helper that ensures an Error was raised.
46 47 48 |
# File 'lib/grumpy_old_man.rb', line 46 def assert_raise(ex, &block) expect(Proc.new(&block)).to raise_error(ex) end |
#refute(arg = nil) ⇒ Object
A simple refute for RSpec.
30 31 32 33 |
# File 'lib/grumpy_old_man.rb', line 30 def refute(arg = nil) arg = yield if block_given? assert_equal !!arg, false end |