Module: Riot

Defined in:
lib/riot.rb,
lib/riot/context.rb,
lib/riot/reporter.rb,
lib/riot/runnable.rb,
lib/riot/situation.rb,
lib/riot/assertion_macros.rb

Defined Under Namespace

Classes: Assertion, Context, DotMatrixReporter, IOReporter, Reporter, RunnableBlock, Setup, SilentReporter, Situation, StoryReporter, VerboseReporter

Class Method Summary collapse

Class Method Details

.context(description, &definition) ⇒ Object



8
9
10
# File 'lib/riot.rb', line 8

def self.context(description, &definition)
  root_contexts << Context.new(description, &definition)
end

.dotsObject



30
# File 'lib/riot.rb', line 30

def self.dots; Riot.reporter = Riot::DotMatrixReporter; end

.reporterObject



24
25
26
# File 'lib/riot.rb', line 24

def self.reporter
  Riot.silently? ? Riot::SilentReporter : (@reporter_class || Riot::StoryReporter)
end

.reporter=(reporter_class) ⇒ Object



27
# File 'lib/riot.rb', line 27

def self.reporter=(reporter_class) @reporter_class = reporter_class; end

.root_contextsObject



12
# File 'lib/riot.rb', line 12

def self.root_contexts; @root_contexts ||= []; end

.runObject



14
15
16
17
18
19
# File 'lib/riot.rb', line 14

def self.run
  the_reporter = reporter.new
  the_reporter.summarize do
    root_contexts.each { |ctx| ctx.run(the_reporter) }
  end
end

.silently!Object



21
# File 'lib/riot.rb', line 21

def self.silently!; @silent = true; end

.silently?Boolean

Returns:

  • (Boolean)


22
# File 'lib/riot.rb', line 22

def self.silently?; @silent == true; end

.verboseObject

TODO: make this a flag that DotMatrix and Story respect and cause them to print errors/failures



29
# File 'lib/riot.rb', line 29

def self.verbose; Riot.reporter = Riot::VerboseReporter; end