Class: Faccts::YAMLTestParser::TestAssertionExtractor
- Inherits:
-
Object
- Object
- Faccts::YAMLTestParser::TestAssertionExtractor
- Defined in:
- lib/faccts/02_parsing_test_specification/yaml_test_parser.rb
Instance Method Summary collapse
- #assertion_is_empty? ⇒ Boolean
- #assertion_is_invalid? ⇒ Boolean
- #from_test_name(test_name, tests_hash) ⇒ Object
-
#initialize(test_assertion_parser_strategy) ⇒ TestAssertionExtractor
constructor
A new instance of TestAssertionExtractor.
- #name_from_assertion_node ⇒ Object
- #test_contains_assertion? ⇒ Boolean
- #test_node ⇒ Object
Constructor Details
#initialize(test_assertion_parser_strategy) ⇒ TestAssertionExtractor
Returns a new instance of TestAssertionExtractor.
85 86 87 |
# File 'lib/faccts/02_parsing_test_specification/yaml_test_parser.rb', line 85 def initialize(test_assertion_parser_strategy) @test_assertion_parser = test_assertion_parser_strategy end |
Instance Method Details
#assertion_is_empty? ⇒ Boolean
105 106 107 |
# File 'lib/faccts/02_parsing_test_specification/yaml_test_parser.rb', line 105 def assertion_is_empty? name_from_assertion_node.nil? end |
#assertion_is_invalid? ⇒ Boolean
117 118 119 |
# File 'lib/faccts/02_parsing_test_specification/yaml_test_parser.rb', line 117 def assertion_is_invalid? name_from_assertion_node.is_a?(Hash) || name_from_assertion_node.is_a?(Array) end |
#from_test_name(test_name, tests_hash) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/faccts/02_parsing_test_specification/yaml_test_parser.rb', line 89 def from_test_name(test_name, tests_hash) @test_assertion_node = tests_hash[test_name] @test_name = test_name return unless test_contains_assertion? return if assertion_is_empty? raise InvalidAssertionError if assertion_is_invalid? test_assertion_parser.parse(test_node) end |
#name_from_assertion_node ⇒ Object
113 114 115 |
# File 'lib/faccts/02_parsing_test_specification/yaml_test_parser.rb', line 113 def name_from_assertion_node test_assertion_node[ASSERTION_NODE_NAME] end |
#test_contains_assertion? ⇒ Boolean
101 102 103 |
# File 'lib/faccts/02_parsing_test_specification/yaml_test_parser.rb', line 101 def test_contains_assertion? test_assertion_node.is_a?(Hash) && test_assertion_node.keys.include?(ASSERTION_NODE_NAME) end |
#test_node ⇒ Object
109 110 111 |
# File 'lib/faccts/02_parsing_test_specification/yaml_test_parser.rb', line 109 def test_node { test_name => test_assertion_node } end |