Module: Riot
- Defined in:
- lib/riot.rb,
lib/riot/rr.rb,
lib/riot/context.rb,
lib/riot/message.rb,
lib/riot/version.rb,
lib/riot/reporter.rb,
lib/riot/runnable.rb,
lib/riot/assertion.rb,
lib/riot/situation.rb,
lib/riot/middleware.rb,
lib/riot/reporter/io.rb,
lib/riot/reporter/story.rb,
lib/riot/assertion_macro.rb,
lib/riot/context_helpers.rb,
lib/riot/context_options.rb,
lib/riot/reporter/silent.rb,
lib/riot/reporter/dot_matrix.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/reporter/pretty_dot_matrix.rb,
lib/riot/assertion_macros/respond_to.rb,
lib/riot/assertion_macros/equivalent_to.rb,
lib/riot/assertion_macros/same_elements.rb,
lib/riot/assertion_macros/raises_kind_of.rb
Overview
The namespace for all of Riot.
Defined Under Namespace
Modules: ContextClassOverrides, ContextHelpers, ContextOptions, RR Classes: AllImportantMiddleware, AnyMacro, Assertion, AssertionMacro, AssignsMacro, BlankSlate, Context, ContextMiddleware, DotMatrixReporter, EmptyMacro, EqualsMacro, EquivalentToMacro, ExistsMacro, Helper, IOReporter, IncludesMacro, KindOfMacro, MatchesMacro, Message, NilMacro, PrettyDotMatrixReporter, RaisesKindOfMacro, RaisesMacro, Reporter, RespondToMacro, RootContext, RunnableBlock, SameElementsMacro, Setup, SilentReporter, Situation, SizeMacro, StoryReporter, VerboseStoryReporter
Constant Summary collapse
- VERSION =
"0.12.7"
Class Method Summary collapse
-
.alone! ⇒ Object
This means you don’t want Riot to run tests for you.
-
.alone? ⇒ Boolean
Responds to whether Riot will run
at_exit
(false) or manually (true). -
.context(description, context_class = Context, &definition) ⇒ Context
A helper for creating/defining root context instances.
-
.dots ⇒ Object
Tells Riot to use DotMatrixReporter for reporting.
-
.options ⇒ Hash
Options that configure how Riot will run.
-
.plain! ⇒ Object
Tells Riot to turn color off in the output.
-
.pretty_dots ⇒ Object
Tells Riot to use PrettyDotMatrixReporter for reporting.
-
.reporter ⇒ Class
Returns the class for the reporter that is currently selected.
-
.reporter=(reporter_class) ⇒ Object
Allows the reporter class to be changed.
-
.reporter_options ⇒ Hash
Returns the options that will be passed to the Reporter when it is created.
-
.root_contexts ⇒ Array
The set of Context instances that have no parent.
-
.run ⇒ Riot::Reporter
How to run Riot itself.
-
.silently! ⇒ Object
This means you don’t want to see any output from Riot.
-
.silently? ⇒ Boolean
Reponds to whether Riot is reporting silently.
-
.verbose ⇒ Object
Tells Riot to use VerboseStoryReporter for reporting.
Class Method Details
.alone! ⇒ Object
This means you don’t want Riot to run tests for you. You will execute Riot.run manually.
69 70 71 |
# File 'lib/riot.rb', line 69 def self.alone! Riot.[:alone] = true end |
.alone? ⇒ Boolean
Responds to whether Riot will run at_exit
(false) or manually (true).
76 77 78 |
# File 'lib/riot.rb', line 76 def self.alone? Riot.[:alone] == true end |
.context(description, context_class = Context, &definition) ⇒ Context
A helper for creating/defining root context instances.
17 18 19 |
# File 'lib/riot.rb', line 17 def self.context(description, context_class = Context, &definition) (root_contexts << context_class.new(description, &definition)).last end |
.dots ⇒ Object
Tells Riot to use DotMatrixReporter for reporting
109 110 111 |
# File 'lib/riot.rb', line 109 def self.dots Riot.reporter = Riot::DotMatrixReporter end |
.options ⇒ Hash
Options that configure how Riot will run.
47 48 49 50 51 52 53 54 |
# File 'lib/riot.rb', line 47 def self. @options ||= { :silent => false, :alone => false, :reporter => Riot::StoryReporter, :reporter_options => {:plain => false} } end |
.plain! ⇒ Object
Tells Riot to turn color off in the output
119 120 121 |
# File 'lib/riot.rb', line 119 def self.plain! Riot.[:plain] = true end |
.pretty_dots ⇒ Object
Tells Riot to use PrettyDotMatrixReporter for reporting
114 115 116 |
# File 'lib/riot.rb', line 114 def self.pretty_dots Riot.reporter = Riot::PrettyDotMatrixReporter end |
.reporter ⇒ Class
Returns the class for the reporter that is currently selected. If no reporter was explicitly selected, StoryReporter will be used.
91 92 93 |
# File 'lib/riot.rb', line 91 def self.reporter Riot.silently? ? Riot::SilentReporter : Riot.[:reporter] end |
.reporter=(reporter_class) ⇒ Object
Allows the reporter class to be changed. Do this before tests are started.
83 84 85 |
# File 'lib/riot.rb', line 83 def self.reporter=(reporter_class) Riot.[:reporter] = reporter_class end |
.reporter_options ⇒ Hash
Returns the options that will be passed to the Reporter when it is created.
98 99 100 |
# File 'lib/riot.rb', line 98 def self. Riot.[:reporter_options] end |
.root_contexts ⇒ Array
The set of Context instances that have no parent.
24 25 26 |
# File 'lib/riot.rb', line 24 def self.root_contexts @root_contexts ||= [] end |
.run ⇒ Riot::Reporter
36 37 38 39 40 41 42 |
# File 'lib/riot.rb', line 36 def self.run the_reporter = reporter.new(Riot.) the_reporter.summarize do root_contexts.each { |ctx| ctx.run(the_reporter) } end unless root_contexts.empty? the_reporter end |
.silently! ⇒ Object
This means you don’t want to see any output from Riot. A “quiet riot”.
57 58 59 |
# File 'lib/riot.rb', line 57 def self.silently! Riot.[:silent] = true end |
.silently? ⇒ Boolean
Reponds to whether Riot is reporting silently.
64 65 66 |
# File 'lib/riot.rb', line 64 def self.silently? Riot.[:silent] == true end |
.verbose ⇒ Object
make this a flag that DotMatrix and Story respect and cause them to print errors/failures
Tells Riot to use VerboseStoryReporter for reporting
104 105 106 |
# File 'lib/riot.rb', line 104 def self.verbose Riot.reporter = Riot::VerboseStoryReporter end |