Class: RSpec::Given::NaturalAssertion
- Inherits:
-
Object
- Object
- RSpec::Given::NaturalAssertion
- Defined in:
- lib/rspec/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
- #using_rspec_assertion? ⇒ Boolean
Constructor Details
#initialize(clause_type, block, example, line_extractor) ⇒ NaturalAssertion
Returns a new instance of NaturalAssertion.
18 19 20 21 22 23 |
# File 'lib/rspec/given/natural_assertion.rb', line 18 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
31 32 33 |
# File 'lib/rspec/given/natural_assertion.rb', line 31 def has_content? assertion_sexp != VOID_SEXP end |
#message ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/rspec/given/natural_assertion.rb', line 35 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 |
#using_rspec_assertion? ⇒ Boolean
27 28 29 |
# File 'lib/rspec/given/natural_assertion.rb', line 27 def using_rspec_assertion? using_should? || using_expect? end |