also allow runner output to be defined in yaml, implements #66

This commit is contained in:
John Bintz 2011-10-11 08:55:43 -04:00
parent 0be7b9e20c
commit 951cf80f09
2 changed files with 48 additions and 7 deletions

View File

@ -82,7 +82,13 @@ module Jasmine
end
def runner_filename
options[:runner_output_filename]
options[:runner_output_filename] || begin
if (runner_output = jasmine_config['runner_output']) && !runner_output.empty?
runner_output
else
false
end
end
end
end
end

View File

@ -103,20 +103,55 @@ describe Jasmine::Headless::Runner do
end
describe '#runner_filename' do
context 'not provided' do
let(:runner_filename) { runner.runner_filename }
let(:yaml_output) { 'yaml output' }
context 'not in options' do
let(:opts) { { :runner_output_filename => false } }
it 'should reverse the remove_html_file option' do
runner.runner_filename.should == false
context 'not in yaml file' do
before do
runner.stubs(:jasmine_config).returns('runner_output' => '')
end
it 'should reverse the remove_html_file option' do
runner_filename.should == false
end
end
context 'in yaml file' do
before do
runner.stubs(:jasmine_config).returns('runner_output' => yaml_output)
end
it 'should use the yaml file definition' do
runner_filename.should == yaml_output
end
end
end
context 'provided' do
context 'in options' do
let(:filename) { 'filename.html' }
let(:opts) { { :runner_output_filename => filename } }
it 'should reverse the remove_html_file option' do
runner.runner_filename.should == filename
context 'not in yaml file' do
before do
runner.stubs(:jasmine_config).returns('runner_output' => '')
end
it 'should reverse the remove_html_file option' do
runner.runner_filename.should == filename
end
end
context 'in yaml file' do
before do
runner.stubs(:jasmine_config).returns('runner_output' => yaml_output)
end
it 'shoulduse the command line filename' do
runner.runner_filename.should == filename
end
end
end
end