class Riot::StoryReporter

For each context that is started and assertion that is run, its description is printed to the console on its own line. Regarding assertions, if ansi-colors are available then passing assertions are printed in green, failing in yellow, and errors in red. Note that backtraces are not reported for errors; see {Riot::VerboseStoryReporter}.

Public Instance Methods

describe_context(context) click to toggle source

Prints the descrition of the context on its own line

@param (see Riot::Reporter#describe_context)

Calls superclass method Riot::Reporter#describe_context
# File lib/riot/reporter/story.rb, line 11
def describe_context(context)
  super
  puts context.detailed_description
end
error(description, e) click to toggle source

Prints the description of the assertion and the exception message. Prints in red if possible.

@param (see Riot::Reporter#error)

# File lib/riot/reporter/story.rb, line 35
def error(description, e)
  puts "  ! " + red("#{description}: #{e.message}")
end
fail(description, message, line, file) click to toggle source

Prints the description of the assertion and the line number of the failure. Prints in yellow if possible.

@param (see Riot::Reporter#fail)

# File lib/riot/reporter/story.rb, line 27
def fail(description, message, line, file)
  puts "  - " + yellow("#{description}: #{message} #{line_info(line, file)}".strip)
end
pass(description, message) click to toggle source

Prints the description of the assertion. Prints in green if possible.

@param (see Riot::Reporter#pass)

# File lib/riot/reporter/story.rb, line 19
def pass(description, message)
  puts "  + " + green("#{description} #{message}".strip)
end