Sha256: 2a9d1006ef2280c7f3857d209155d26039fad36dbe9258b9b484c118949112aa
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
module OpalSpec class Runner def self.in_browser? %x{ if (typeof(window) !== 'undefined' && typeof(document) !== 'undefined') { return true; } return false; } end def self.in_phantom? %x{ if (typeof(phantom) !== 'undefined' || typeof(OPAL_SPEC_PHANTOM) !== 'undefined') { return true; } return false; } end def self.autorun if in_browser? %x{ setTimeout(function() { #{ Runner.new.run }; }, 0); } else Runner.new.run end end def initialize if Runner.in_phantom? @formatter = PhantomFormatter.new elsif Runner.in_browser? @formatter = BrowserFormatter.new end end def run @groups = ExampleGroup.example_groups.dup @formatter.start run_next_group end def run_next_group if @groups.empty? @formatter.finish else @groups.shift.run self end end def example_group_started group @formatter.example_group_started group end def example_group_finished group @formatter.example_group_finished group run_next_group end def example_started example @formatter.example_started example end def example_passed example @formatter.example_passed example end def example_failed example @formatter.example_failed example end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opal-spec-0.2.6 | lib/opal-spec/runner.rb |
opal-spec-0.2.5 | lib/opal-spec/runner.rb |
opal-spec-0.2.1 | lib/opal-spec/runner.rb |