Class: Jasmine::CiRunner
- Inherits:
-
Object
- Object
- Jasmine::CiRunner
- Defined in:
- lib/jasmine/ci_runner.rb
Instance Method Summary collapse
-
#initialize(config, options = {}) ⇒ CiRunner
constructor
A new instance of CiRunner.
- #run ⇒ Object
Constructor Details
#initialize(config, options = {}) ⇒ CiRunner
Returns a new instance of CiRunner.
3 4 5 6 7 8 9 10 11 |
# File 'lib/jasmine/ci_runner.rb', line 3 def initialize(config, ={}) @config = config @thread = .fetch(:thread, Thread) @application_factory = .fetch(:application_factory, Jasmine::Application) @server_factory = .fetch(:server_factory, Jasmine::Server) @outputter = .fetch(:outputter, Kernel) @random = .fetch(:random, config.random) @seed = .has_key?(:seed) ? "&seed=#{[:seed]}" : '' end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jasmine/ci_runner.rb', line 13 def run formatters = build_formatters exit_code_formatter = Jasmine::Formatters::ExitCode.new formatters << exit_code_formatter url = "#{config.host}:#{config.port(:ci)}/?throwFailures=#{config.stop_spec_on_expectation_failure}&failFast=#{config.stop_on_spec_failure}&random=#{@random}#{@seed}" runner = config.runner.call(Jasmine::Formatters::Multi.new(formatters), url) if runner.respond_to?(:boot_js) config.runner_boot_dir = File.dirname(runner.boot_js) config.runner_boot_files = lambda { [runner.boot_js] } end server = @server_factory.new(config.port(:ci), app, config.) t = @thread.new do server.start end t.abort_on_exception = true Jasmine::wait_for_listener(config.port(:ci), config.host.sub(/\Ahttps?:\/\//, '')) @outputter.puts 'jasmine server started' runner.run exit_code_formatter.succeeded? end |