Module: XSpec::Evaluator::Simple
- Defined in:
- lib/xspec/evaluators.rb
Overview
### Simple Assertions
This simple evaluator provides very straight-forward assertion methods.
Instance Method Summary collapse
- #assert(proposition, message = nil) ⇒ Object
- #assert_equal(expected, actual) ⇒ Object
- #assert_include(expected, output) ⇒ Object
- #call(unit_of_work) ⇒ Object
- #fail(message = nil) ⇒ Object
Instance Method Details
#assert(proposition, message = nil) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/xspec/evaluators.rb', line 56 def assert(proposition, =nil) unless proposition ||= 'assertion failed' _raise end end |
#assert_equal(expected, actual) ⇒ Object
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/xspec/evaluators.rb', line 64 def assert_equal(expected, actual) unless expected == actual ||= <<-EOS.chomp want: #{expected.inspect} got: #{actual.inspect} EOS _raise end end |
#assert_include(expected, output) ⇒ Object
75 76 77 78 |
# File 'lib/xspec/evaluators.rb', line 75 def assert_include(expected, output) assert output.include?(expected), "#{expected.inspect} not present in: #{output.inspect}" end |
#call(unit_of_work) ⇒ Object
52 53 54 |
# File 'lib/xspec/evaluators.rb', line 52 def call(unit_of_work) super end |
#fail(message = nil) ⇒ Object
80 81 82 83 84 |
# File 'lib/xspec/evaluators.rb', line 80 def fail( = nil) ||= 'failed' _raise end |