merge jasmine.yml keys the same way as the gem
This commit is contained in:
parent
cba18bfd22
commit
894b979674
@ -45,9 +45,13 @@ module Jasmine
|
||||
end
|
||||
|
||||
def jasmine_config
|
||||
raise JasmineConfigNotFound.new("Jasmine config not found. I tried #{@options[:jasmine_config]}.") if !File.file?(@options[:jasmine_config])
|
||||
return @jasmine_config if @jasmine_config
|
||||
|
||||
@jasmine_config ||= JASMINE_DEFAULTS.dup.merge(YAML.load_file(@options[:jasmine_config]))
|
||||
@jasmine_config = JASMINE_DEFAULTS.dup
|
||||
jasmine_config_data.each do |key, value|
|
||||
@jasmine_config[key] = value if value
|
||||
end
|
||||
@jasmine_config
|
||||
end
|
||||
|
||||
def jasmine_command(*targets)
|
||||
@ -88,6 +92,13 @@ module Jasmine
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def jasmine_config_data
|
||||
raise JasmineConfigNotFound.new("Jasmine config not found. I tried #{@options[:jasmine_config]}.") if !File.file?(@options[:jasmine_config])
|
||||
|
||||
YAML.load_file(@options[:jasmine_config])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -155,4 +155,16 @@ describe Jasmine::Headless::Runner do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#jasmine_config' do
|
||||
let(:opts) { {} }
|
||||
|
||||
before do
|
||||
runner.stubs(:jasmine_config_data).returns('spec_files' => nil)
|
||||
end
|
||||
|
||||
it 'should not merge in things with nil values' do
|
||||
runner.jasmine_config['spec_files'].should == described_class::JASMINE_DEFAULTS['spec_files']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user