Module: Riot

Defined in:
lib/riot.rb,
lib/riot/context.rb,
lib/riot/reporter.rb,
lib/riot/runnable.rb,
lib/riot/assertion.rb,
lib/riot/situation.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/same_elements.rb

Defined Under Namespace

Classes: AnyMacro, Assertion, AssertionMacro, AssignsMacro, Context, DotMatrixReporter, EmptyMacro, EqualsMacro, ExistsMacro, IOReporter, IncludesMacro, KindOfMacro, MatchesMacro, 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.



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

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

.alone?Boolean

Returns:

  • (Boolean)


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

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

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



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

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

.dotsObject



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

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

.reporterObject



32
33
34
35
36
37
38
# File 'lib/riot.rb', line 32

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

.reporter=(reporter_class) ⇒ Object



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

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

.root_contextsObject



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

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

.runObject



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

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



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

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

.silently?Boolean

Returns:

  • (Boolean)


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

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



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

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