Module: Riot

Defined in:
lib/riot.rb,
lib/riot/rr.rb,
lib/riot/context.rb,
lib/riot/message.rb,
lib/riot/reporter.rb,
lib/riot/runnable.rb,
lib/riot/assertion.rb,
lib/riot/situation.rb,
lib/riot/middleware.rb,
lib/riot/assertion_macro.rb,
lib/riot/assertion_macros/any.rb,
lib/riot/assertion_macros/nil.rb,
lib/riot/assertion_macros/size.rb,
lib/riot/assertion_macros/empty.rb,
lib/riot/assertion_macros/equals.rb,
lib/riot/assertion_macros/exists.rb,
lib/riot/assertion_macros/raises.rb,
lib/riot/assertion_macros/assigns.rb,
lib/riot/assertion_macros/kind_of.rb,
lib/riot/assertion_macros/matches.rb,
lib/riot/assertion_macros/includes.rb,
lib/riot/assertion_macros/not_borat.rb,
lib/riot/assertion_macros/respond_to.rb,
lib/riot/assertion_macros/equivalent_to.rb,
lib/riot/assertion_macros/same_elements.rb

Defined Under Namespace

Modules: ContextClassOverrides, ContextOptions, RR Classes: AllImportantMiddleware, AnyMacro, Assertion, AssertionMacro, AssignsMacro, Context, ContextMiddleware, DotMatrixReporter, EmptyMacro, EqualsMacro, EquivalentToMacro, ExistsMacro, Helper, IOReporter, IncludesMacro, KindOfMacro, MatchesMacro, Message, NilMacro, NotMacro, RaisesMacro, Reporter, RespondToMacro, RootContext, RunnableBlock, SameElementsMacro, Setup, SilentReporter, Situation, SizeMacro, StoryReporter, VerboseStoryReporter

Class Method Summary collapse

Class Method Details

.alone!Object

This means you don’t want Riot to run tests for you. You will execute Riot.run manually.



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

def self.alone!; @alone = true; end

.alone?Boolean

Returns:

  • (Boolean)


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

def self.alone?; defined?(@alone) && @alone == true end

.context(description, context_class = Context, &definition) ⇒ Object



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

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

.dotsObject



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

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

.reporterObject



34
35
36
37
38
39
40
# File 'lib/riot.rb', line 34

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

.reporter=(reporter_class) ⇒ Object



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

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

.root_contextsObject



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

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

.runObject



16
17
18
19
20
21
22
# File 'lib/riot.rb', line 16

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

.silently!Object

This means you don’t want to see any output from Riot. A “quiet riot” as Envy5 put it.



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

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

.silently?Boolean

Returns:

  • (Boolean)


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

def self.silently?; defined?(@silent) && @silent == true end

.verboseObject

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



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

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