fix running from non-cli

This commit is contained in:
John Bintz 2011-06-16 10:11:37 -04:00
parent cdff35c0e2
commit 50bd14a82e
4 changed files with 16 additions and 1 deletions
lib/jasmine/headless
spec

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -20,3 +20,4 @@ RSpec::Matchers.define :be_a_report_containing do |total, fails, used_console|
true
end
end