Class: Cucumber::Formatter::LegacyApi::Adapter::FeaturePrinter
- Defined in:
- lib/cucumber/formatter/legacy_api/adapter.rb
Instance Attribute Summary collapse
-
#current_test_step_source ⇒ Object
readonly
Returns the value of attribute current_test_step_source.
Instance Method Summary collapse
- #after ⇒ Object
- #after_hook(location, result) ⇒ Object
- #after_step_hook(hook, result) ⇒ Object
- #after_test_case(test_case, test_case_result) ⇒ Object
- #after_test_step(test_step, result) ⇒ Object
- #background(node) ⇒ Object
- #before ⇒ Object
- #before_hook(location, result) ⇒ Object
- #before_test_case(test_case) ⇒ Object
- #before_test_step(test_step) ⇒ Object
- #embed(src, mime_type, label) ⇒ Object
- #examples_table ⇒ Object
- #examples_table_row ⇒ Object
- #feature ⇒ Object
- #puts(messages) ⇒ Object
- #scenario ⇒ Object
- #scenario_outline ⇒ Object
- #step ⇒ Object
Instance Attribute Details
#current_test_step_source ⇒ Object (readonly)
Returns the value of attribute current_test_step_source.
217 218 219 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 217 def current_test_step_source @current_test_step_source end |
Instance Method Details
#after ⇒ Object
300 301 302 303 304 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 300 def after @child.after if @child formatter.after_feature(node) self end |
#after_hook(location, result) ⇒ Object
263 264 265 266 267 268 269 270 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 263 def after_hook(location, result) # if the scenario has no steps, we can hit this before we've created the scenario printer # ideally we should call switch_step_container in before_step_step switch_step_container if !@child @child.after_hook Ast::HookResult.new(LegacyResultBuilder.new(result), @delayed_messages, @delayed_embeddings) @delayed_messages = [] @delayed_embeddings = [] end |
#after_step_hook(hook, result) ⇒ Object
272 273 274 275 276 277 278 279 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 272 def after_step_hook(hook, result) p current_test_step_source if current_test_step_source.step.nil? line = StepBacktraceLine.new(current_test_step_source.step) @child.after_step_hook Ast::HookResult.new(LegacyResultBuilder.new(result). append_to_exception_backtrace(line), @delayed_messages, @delayed_embeddings) @delayed_messages = [] @delayed_embeddings = [] end |
#after_test_case(test_case, test_case_result) ⇒ Object
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 235 def after_test_case(test_case, test_case_result) if current_test_step_source && current_test_step_source.step_result.nil? switch_step_container end if test_case_result.failed? && !any_test_steps_failed? # around hook must have failed. Print the error. switch_step_container(TestCaseSource.for(test_case, test_case_result)) LegacyResultBuilder.new(test_case_result).describe_exception_to formatter end # messages and embedding should already have been handled, but just in case... @delayed_messages.each { || formatter.puts() } @delayed_embeddings.each { || .send_to_formatter(formatter) } @delayed_messages = [] @delayed_embeddings = [] @child.after_test_case if @child @previous_test_case_background = @current_test_case_background @previous_test_case_scenario_outline = current_test_step_source && current_test_step_source.scenario_outline end |
#after_test_step(test_step, result) ⇒ Object
227 228 229 230 231 232 233 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 227 def after_test_step(test_step, result) @current_test_step_source = TestStepSource.for(test_step, result) # TODO: stop calling self, and describe source to another object test_step.describe_source_to(self, result) print_step @test_step_results << result end |
#background(node) ⇒ Object
281 282 283 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 281 def background(node, *) @current_test_case_background = node end |
#before ⇒ Object
207 208 209 210 211 212 213 214 215 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 207 def before formatter.before_feature(node) Ast::Comments.new(node.comments).accept(formatter) Ast::Tags.new(node.).accept(formatter) formatter.feature_name node.keyword, indented(node.legacy_conflated_name_and_description) @delayed_messages = [] @delayed_embeddings = [] self end |
#before_hook(location, result) ⇒ Object
257 258 259 260 261 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 257 def before_hook(location, result) @before_hook_results << Ast::HookResult.new(LegacyResultBuilder.new(result), @delayed_messages, @delayed_embeddings) @delayed_messages = [] @delayed_embeddings = [] end |
#before_test_case(test_case) ⇒ Object
219 220 221 222 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 219 def before_test_case(test_case) @before_hook_results = Ast::HookResultCollection.new @test_step_results = [] end |
#before_test_step(test_step) ⇒ Object
224 225 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 224 def before_test_step(test_step) end |
#embed(src, mime_type, label) ⇒ Object
289 290 291 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 289 def (src, mime_type, label) @delayed_embeddings.push Embedding.new(src, mime_type, label) end |
#examples_table ⇒ Object
296 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 296 def examples_table(*);end |
#examples_table_row ⇒ Object
297 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 297 def examples_table_row(*);end |
#feature ⇒ Object
298 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 298 def feature(*);end |
#puts(messages) ⇒ Object
285 286 287 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 285 def puts() @delayed_messages.push * end |
#scenario ⇒ Object
294 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 294 def scenario(*);end |
#scenario_outline ⇒ Object
295 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 295 def scenario_outline(*);end |
#step ⇒ Object
293 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 293 def step(*);end |