Class: Guard::Jasmine::Runner
- Inherits:
-
Object
- Object
- Guard::Jasmine::Runner
- Includes:
- Util
- Defined in:
- lib/guard/jasmine/runner.rb
Overview
The Jasmine runner handles the execution of the spec through the PhantomJS binary,
evaluates the JSON response from the PhantomJS Script guard_jasmine.coffee,
writes the result to the console and triggers optional system notifications.
Constant Summary collapse
- THRESHOLDS =
Name of the coverage threshold options
[:statements_threshold, :functions_threshold, :branches_threshold, :lines_threshold].freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ Runner
constructor
Run the supplied specs.
-
#run(paths, per_run_options = {}) ⇒ Hash<String,Array>
Keys for the spec_file, value is array of failure messages.
Methods included from Util
#find_free_server_port, #phantomjs_bin_valid?, #runner_available?, #which
Constructor Details
#initialize(options) ⇒ Runner
Run the supplied specs.
40 41 42 |
# File 'lib/guard/jasmine/runner.rb', line 40 def initialize() @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
19 20 21 |
# File 'lib/guard/jasmine/runner.rb', line 19 def @options end |
Instance Method Details
#run(paths, per_run_options = {}) ⇒ Hash<String,Array>
Returns keys for the spec_file, value is array of failure messages. Only specs with failures will be returned. Therefore an empty? return hash indicates success.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/guard/jasmine/runner.rb', line 47 def run(paths, = {}) = @options @options.merge!() return {} if paths.empty? (paths) run_results = paths.each_with_object({}) do |file, results| if File.exist?(file_and_line_number_parts(file)[0]) results[file] = evaluate_response(run_jasmine_spec(file), file) end end # return the errors return run_results.each_with_object({}) do |spec_run, hash| file, r = spec_run errors = collect_spec_errors(r['suites'] || []) errors.push(r['error']) if r.key? 'error' hash[file] = errors unless errors.empty? end ensure @options = end |