Module: Concordion::InternalTestMethods
Constant Summary
collapse
- @@EXPECTED_FAILURE_COUNT =
0
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
#assignment, #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?
Instance Method Details
#assert_concordion_document(config) ⇒ Object
105
106
107
|
# File 'lib/concordion/test_methods.rb', line 105
def assert_concordion_document(config)
assert_equal "http://www.concordion.org/2007/concordion", config[:parser].html.get_attribute("xmlns:concordion")
end
|
#assert_no_failures(outfilename, config, failures) ⇒ Object
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/concordion/test_methods.rb', line 82
def assert_no_failures(outfilename, config, failures)
expected = @@EXPECTED_FAILURE_COUNT
if self.class.method_defined?(:expected_failure_count)
expected = expected_failure_count()
end
message = build_message "#{show_failures(failures)}\nWrote output to #{outfilename}.",
'Actual failure count <?> did not match expected <?>.',
failures.size, expected
assert_block message do
failures.size == expected
end
end
|
#parse_spec(filename, config) ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/concordion/test_methods.rb', line 50
def parse_spec(filename,config)
config[:parser].parse(filename)
assert_concordion_document(config)
if self.class.method_defined?(:css_type)
config[:decorator].add_concordion_css_link(config[:parser].root, config[:parser].html, css_type)
else
config[:decorator].add_concordion_css_link(config[:parser].root, config[:parser].html, config[:css_type])
end
end
|
#report_spec(filename, config, failures) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/concordion/test_methods.rb', line 70
def report_spec(filename, config, failures)
config[:decorator].add_css_file_to_output_dir(config[:writer], config[:css_type])
writer = config[:writer]
if self.class.method_defined?(:rcor_writer)
writer = rcor_writer()
end
outfilename = writer.calculate_filename_and_overwrite(config[:parser].root, filename)
assert_no_failures(outfilename, config, failures)
end
|
#run_spec(filename, config) ⇒ Object
61
62
63
64
65
66
67
68
|
# File 'lib/concordion/test_methods.rb', line 61
def run_spec(filename, config)
failures = []
config[:parser].each_eligible_concordion_element do |elem|
failure = config[:processor].process(elem, self)
failures << failure unless failure.nil?
end
failures
end
|
#show_failures(failures) ⇒ Object
97
98
99
100
101
102
103
|
# File 'lib/concordion/test_methods.rb', line 97
def show_failures(failures)
rv = ""
failures.each_with_index do |failure, index|
rv += "[Error:#{index + 1}] #{failure}\n"
end
rv
end
|