Class: JazzMoney::Runner
- Inherits:
-
Object
- Object
- JazzMoney::Runner
- Defined in:
- lib/jazz_money/runner.rb
Overview
TODO: rename. easy to confuse with JasmineRunner. or rename JasmineRunner.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(js_includes, jasmine_spec_files) ⇒ Runner
constructor
A new instance of Runner.
- #report_spec_results(spec_id, results_for_spec) ⇒ Object
- #results ⇒ Object
Constructor Details
#initialize(js_includes, jasmine_spec_files) ⇒ Runner
Returns a new instance of Runner.
20 21 22 23 24 25 |
# File 'lib/jazz_money/runner.rb', line 20 def initialize(js_includes, jasmine_spec_files) @page = Harmony::Page.new @jasmine_runner = JasmineRunner.new(@page, jasmine_spec_files, js_includes, self) @js_includes = js_includes @jasmine_spec_files = jasmine_spec_files end |
Class Method Details
.from_jasmine_config ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jazz_money/runner.rb', line 6 def self.from_jasmine_config jasmine_config = Jasmine::Config.new unless jasmine_config.stylesheets.empty? warn "WARNING: JazzMoney does not support stylesheets!" end spec_files = jasmine_config.spec_files.map { |path| File.join(jasmine_config.spec_dir, path) } helper_files = jasmine_config.helpers.map { |path| File.join(jasmine_config.spec_dir, path) } src_files = jasmine_config.src_files.map { |path| File.join(jasmine_config.src_dir, path) } self.new(src_files, helper_files + spec_files) end |
Instance Method Details
#call ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/jazz_money/runner.rb', line 27 def call @jasmine_runner.start # johnson is not thread-safe, so serialize the suites into ruby objects suites = JSON.parse(@page.execute_js('JSON.stringify(jsApiReporter.suites());')) rspec_thread = RspecThread.start(suites, self) @jasmine_runner.wait rspec_thread.join end |
#report_spec_results(spec_id, results_for_spec) ⇒ Object
37 38 39 |
# File 'lib/jazz_money/runner.rb', line 37 def report_spec_results(spec_id, results_for_spec) results[spec_id] = JSON.parse(results_for_spec) end |
#results ⇒ Object
41 42 43 |
# File 'lib/jazz_money/runner.rb', line 41 def results @results ||= {}; end |