Class: Given::NaturalAssertion
- Inherits:
-
Object
- Object
- Given::NaturalAssertion
- Defined in:
- lib/given/natural_assertion.rb
Constant Summary collapse
- VOID_SEXP =
[:void_stmt]
Instance Method Summary collapse
- #has_content? ⇒ Boolean
-
#initialize(clause_type, block, example, line_extractor) ⇒ NaturalAssertion
constructor
A new instance of NaturalAssertion.
- #message ⇒ Object
Constructor Details
#initialize(clause_type, block, example, line_extractor) ⇒ NaturalAssertion
Returns a new instance of NaturalAssertion.
16 17 18 19 20 21 |
# File 'lib/given/natural_assertion.rb', line 16 def initialize(clause_type, block, example, line_extractor) @clause_type = clause_type @evaluator = Evaluator.new(example, block) @line_extractor = line_extractor set_file_and_line(block) end |
Instance Method Details
#has_content? ⇒ Boolean
25 26 27 |
# File 'lib/given/natural_assertion.rb', line 25 def has_content? assertion_sexp != VOID_SEXP end |
#message ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/given/natural_assertion.rb', line 29 def @output = "#{@clause_type} expression failed at #{source_line}\n" @output << "Failing expression: #{source.strip}\n" if @clause_type != "Then" explain_failure display_pairs(expression_value_pairs) @output << "\n" @output end |