diff --git a/lib/jasmine/headless/runner.rb b/lib/jasmine/headless/runner.rb index a571597..bede357 100644 --- a/lib/jasmine/headless/runner.rb +++ b/lib/jasmine/headless/runner.rb @@ -24,7 +24,10 @@ module Jasmine RUNNER = File.expand_path('../../../../ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner', __FILE__) - def self.run(options = DEFAULT_OPTIONS.dup) + attr_reader :options + + def self.run(options = {}) + options = Options.new(options) if !options.kind_of?(Options) new(options).run end @@ -60,6 +63,7 @@ module Jasmine system jasmine_command(run_targets) status = $?.exitstatus + p @options if @options[:remove_html_file] || (status == 0) targets.each { |target| FileUtils.rm_f target } end diff --git a/spec/bin/jasmine-headless-webkit_spec.rb b/spec/bin/jasmine-headless-webkit_spec.rb index 8d00b77..f1e31f1 100644 --- a/spec/bin/jasmine-headless-webkit_spec.rb +++ b/spec/bin/jasmine-headless-webkit_spec.rb @@ -23,6 +23,7 @@ describe "jasmine-headless-webkit" do describe 'success but with js error' do it "should succeed with error code 0" do + p "here" system %{bin/jasmine-headless-webkit -j spec/jasmine/success_with_error/success_with_error.yml --report #{report}} $?.exitstatus.should == 1 diff --git a/spec/lib/jasmine/headless/runner_spec.rb b/spec/lib/jasmine/headless/runner_spec.rb index 1b62747..3b248e5 100644 --- a/spec/lib/jasmine/headless/runner_spec.rb +++ b/spec/lib/jasmine/headless/runner_spec.rb @@ -6,6 +6,15 @@ describe Jasmine::Headless::Runner do let(:runner) { Jasmine::Headless::Runner.new(options) } let(:options) { Jasmine::Headless::Options.new(opts) } + describe '#initialize' do + let(:opts) { { :test => 'test' } } + + it 'should have default options' do + runner.options[:test].should == 'test' + runner.options[:jasmine_config].should == 'spec/javascripts/support/jasmine.yml' + end + end + describe '#load_config' do include FakeFS::SpecHelpers diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1a239b3..fdb4dda 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,3 +20,4 @@ RSpec::Matchers.define :be_a_report_containing do |total, fails, used_console| true end end +