Class: Concordion::ParseResult
- Inherits:
-
Object
- Object
- Concordion::ParseResult
show all
- Includes:
- Utility
- Defined in:
- lib/concordion/parse_result.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Utility
#concordion_arguments, #concordion_cmd_attr_exists?, #concordion_cmd_attr_for, #concordion_property_reference, #concordion_variable_name, #has_property_reference?, #instrumentation
#attr_writer_method?, #concordion_assignment, #concordion_method_name, #ends_in_empty_parens?, #escape_single_quotes, #has_arguments?, #has_assignment?, #is_direct_method_call?
#singular
#snake_case, #snake_cased_goldmaster_name, #snake_cased_test_name
Methods included from Constants
#concordion_command_attributes, #supported?
Constructor Details
#initialize(cmd, sut, content, tag) ⇒ ParseResult
Returns a new instance of ParseResult.
7
8
9
10
11
12
|
# File 'lib/concordion/parse_result.rb', line 7
def initialize(cmd, sut, content, tag)
@concordion_command = cmd
@system_under_test = sut
@content = content
@tag = tag
end
|
Instance Attribute Details
#concordion_command ⇒ Object
Returns the value of attribute concordion_command.
6
7
8
|
# File 'lib/concordion/parse_result.rb', line 6
def concordion_command
@concordion_command
end
|
#content ⇒ Object
Returns the value of attribute content.
6
7
8
|
# File 'lib/concordion/parse_result.rb', line 6
def content
@content
end
|
#system_under_test ⇒ Object
Returns the value of attribute system_under_test.
6
7
8
|
# File 'lib/concordion/parse_result.rb', line 6
def system_under_test
@system_under_test
end
|
#tag ⇒ Object
Returns the value of attribute tag.
6
7
8
|
# File 'lib/concordion/parse_result.rb', line 6
def tag
@tag
end
|
Instance Method Details
#assertion_error(actual) ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/concordion/parse_result.rb', line 58
def assertion_error(actual)
if is_assert_true_command?
@tag.inner_html += ": expected true but received #{actual}"
else
@tag.inner_html += " expected but received #{actual}"
end
end
|
#assignment ⇒ Object
43
44
45
|
# File 'lib/concordion/parse_result.rb', line 43
def assignment
concordion_assignment(@system_under_test)
end
|
#attribute_error(actual, expected) ⇒ Object
66
67
68
69
70
71
72
|
# File 'lib/concordion/parse_result.rb', line 66
def attribute_error(actual, expected)
if is_verify_command?
verify_error(actual, expected)
else
assertion_error(actual)
end
end
|
#image_location ⇒ Object
38
39
40
41
|
# File 'lib/concordion/parse_result.rb', line 38
def image_location
return nil if @tag.nil?
@tag.get_attribute('src')
end
|
#is_assert_image_command? ⇒ Boolean
17
18
19
|
# File 'lib/concordion/parse_result.rb', line 17
def is_assert_image_command?
"assert_image" == @concordion_command
end
|
#is_assert_true_command? ⇒ Boolean
30
31
32
|
# File 'lib/concordion/parse_result.rb', line 30
def is_assert_true_command?
"asserttrue" == @concordion_command
end
|
#is_execute_command? ⇒ Boolean
27
28
29
|
# File 'lib/concordion/parse_result.rb', line 27
def is_execute_command?
"execute" == @concordion_command
end
|
#is_set_command? ⇒ Boolean
21
22
23
|
# File 'lib/concordion/parse_result.rb', line 21
def is_set_command?
"set" == @concordion_command
end
|
#is_verify_command? ⇒ Boolean
24
25
26
|
# File 'lib/concordion/parse_result.rb', line 24
def is_verify_command?
"verifyrows" == @concordion_command
end
|
#needs_dereference? ⇒ Boolean
47
48
49
|
# File 'lib/concordion/parse_result.rb', line 47
def needs_dereference?
@system_under_test =~ /^#/ && @system_under_test.index("=").nil?
end
|
#num_results_expected ⇒ Object
34
35
36
|
# File 'lib/concordion/parse_result.rb', line 34
def num_results_expected
@tag.search("tr").size - 1
end
|
#to_s ⇒ Object
13
14
15
|
# File 'lib/concordion/parse_result.rb', line 13
def to_s
"Concordion command[#{@concordion_command}], System under test method[#{@system_under_test}], Tag Content[#{@content}] Image Location[#{image_location}]"
end
|
#verify_error(actual, expected) ⇒ Object
51
52
53
54
55
56
|
# File 'lib/concordion/parse_result.rb', line 51
def verify_error(actual, expected)
if actual > expected
diff = actual - expected
@tag.inner_html += "<tr><td>[#{diff} Surplus Row(s) Returned By Fixture]</td></tr>"
end
end
|