make the rake task use the shiny new runner

This commit is contained in:
John Bintz 2011-06-16 19:38:45 -04:00
parent 96352d21a0
commit 293763cc1e
4 changed files with 21 additions and 4 deletions

View File

@ -27,7 +27,8 @@ module Jasmine
end
def initialize(opts = {})
@options = DEFAULT_OPTIONS.dup.merge(opts)
@options = DEFAULT_OPTIONS.dup
opts.each { |k, v| @options[k] = v if v }
end
def process_option(*args)

View File

@ -1,3 +1,5 @@
require 'jasmine/headless/runner'
module Jasmine
module Headless
class Task
@ -18,7 +20,11 @@ module Jasmine
desc 'Run Jasmine specs headlessly'
task name do
system %{jasmine-headless-webkit #{@colors ? "-c" : "--no-colors"} #{@keep_on_error ? "--keep" : ""} #{@jasmine_config ? "-j #{@jasmine_config}" : ""}}
Jasmine::Headless::Runner.run(
:colors => colors,
:remove_html_file => !@keep_on_error,
:jasmine_config => @jasmine_config
)
end
end
end

View File

@ -7,9 +7,11 @@ describe Jasmine::Headless::Options do
let(:opts) { {} }
describe '#initialize' do
let(:default_config) { 'spec/javascripts/support/jasmine.yml' }
context 'empty' do
it "should have default options" do
options[:jasmine_config].should == 'spec/javascripts/support/jasmine.yml'
options[:jasmine_config].should == default_config
end
end
@ -20,6 +22,14 @@ describe Jasmine::Headless::Options do
options[:jasmine_config].should == 'test'
end
end
context 'with nil provided' do
let(:opts) { { :jasmine_config => nil } }
it 'should override an option' do
options[:jasmine_config].should == default_config
end
end
end
describe '#process_option' do

View File

@ -7,7 +7,7 @@ describe Jasmine::Headless::Runner do
let(:options) { Jasmine::Headless::Options.new(opts) }
describe '#initialize' do
let(:opts) { { :test => 'test' } }
let(:opts) { { :test => 'test', :jasmine_config => nil } }
it 'should have default options' do
runner.options[:test].should == 'test'