Sha256: 964f53dd5390a14cceefd863c296bbbe08d32d353eda2f2d4ccc6921f8998630
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
require 'riot/reporter' require 'riot/context' require 'riot/situation' require 'riot/runnable' require 'riot/assertion' require 'riot/assertion_macros' module Riot def self.context(description, context_class = Context, &definition) root_contexts << context_class.new(description, &definition) end def self.root_contexts; @root_contexts ||= []; end def self.run the_reporter = reporter.new the_reporter.summarize do root_contexts.each { |ctx| ctx.run(the_reporter) } end end def self.silently!; @silent = true; end def self.silently?; defined?(@silent) && @silent == true end def self.reporter=(reporter_class) @reporter_class = reporter_class; end def self.reporter if Riot.silently? Riot::SilentReporter else (defined?(@reporter_class) && @reporter_class) || Riot::StoryReporter end end # TODO: make this a flag that DotMatrix and Story respect and cause them to print errors/failures def self.verbose; Riot.reporter = Riot::VerboseStoryReporter; end def self.dots; Riot.reporter = Riot::DotMatrixReporter; end at_exit { run unless Riot.silently? } end # Riot class Object def context(description, &definition) Riot.context(description, &definition) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
riot-0.10.7 | lib/riot.rb |