module TestBench::Fixture::Controls::Output::Exercise

Public Class Methods

call(output=nil, &block) click to toggle source
# File lib/test_bench/fixture/controls/output.rb, line 20
def self.call(output=nil, &block)
  output ||= Output.example

  each_method do |method_name, args|
    output.public_send(method_name, *args)

    block.(method_name, args) unless block.nil?
  end
end
each_method(&block) click to toggle source
# File lib/test_bench/fixture/controls/output.rb, line 30
def self.each_method(&block)
  result = Controls::Result.example
  path = Controls::TestFile.path
  fixture = Controls::Fixture.example
  caller_location = Controls::CallerLocation.example
  error = Controls::Error.example
  comment_text = 'Some comment'
  detail_text = 'Some detail'
  test_title = 'Some test'
  context_title = 'Some Context'

  {
    :start => [],
    :enter_file => [path],
    :exit_file => [path, result],
    :start_fixture => [fixture],
    :finish_fixture => [fixture, result],
    :assert => [result, caller_location],
    :comment => [comment_text],
    :detail => [detail_text],
    :error => [error],
    :start_test => [test_title],
    :finish_test => [test_title, result],
    :skip_test => [test_title],
    :enter_context => [context_title],
    :exit_context => [context_title, result],
    :skip_context => [context_title],
    :finish => [result]
  }.each(&block)
end