requisite pre-release code cleanup
This commit is contained in:
parent
3d51cecf03
commit
f6f975a8c9
@ -27,8 +27,8 @@ opts = GetoptLong.new(
|
||||
|
||||
options = { :colors => false }
|
||||
|
||||
process_options = lambda { |*args|
|
||||
opt = args.shift
|
||||
@process_options = lambda { |*args|
|
||||
opt = args.flatten.shift
|
||||
case opt
|
||||
when '--colors', '-c'
|
||||
options[:colors] = true
|
||||
@ -37,11 +37,9 @@ process_options = lambda { |*args|
|
||||
end
|
||||
}
|
||||
|
||||
if File.file?('.jasmine-headless-webkit')
|
||||
File.readlines('.jasmine-headless-webkit').collect { |line| line.strip.split(' ', 2) }.flatten(1).each(&process_options)
|
||||
end
|
||||
read_defaults_file if defaults_file?
|
||||
|
||||
opts.each(&process_options)
|
||||
opts.each(&@process_options)
|
||||
|
||||
data = YAML.load_file(ARGV.shift || 'spec/javascripts/support/jasmine.yml')
|
||||
|
||||
|
@ -9,9 +9,19 @@ module Jasmine
|
||||
'src_files' => []
|
||||
}
|
||||
|
||||
DEFAULTS_FILE = '.jasmine-headless-webkit'
|
||||
|
||||
def process_jasmine_config(overrides = {})
|
||||
DEFAULTS.merge(overrides)
|
||||
end
|
||||
|
||||
def read_defaults_file
|
||||
File.readlines(DEFAULTS_FILE).collect { |line| line.strip.split(' ', 2) }.each(&@process_options)
|
||||
end
|
||||
|
||||
def defaults_file?
|
||||
File.file?(DEFAULTS_FILE)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
require 'spec_helper'
|
||||
require 'jasmine/cli'
|
||||
require 'fakefs/spec_helpers'
|
||||
|
||||
describe Jasmine::CLI do
|
||||
include Jasmine::CLI
|
||||
include FakeFS::SpecHelpers
|
||||
|
||||
describe '#process_jasmine_config' do
|
||||
context 'without overrides' do
|
||||
@ -38,7 +40,23 @@ describe Jasmine::CLI do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#get_files' do
|
||||
describe '#read_defaults_file' do
|
||||
let(:test_data) { %w{first second} }
|
||||
|
||||
before do
|
||||
File.open(DEFAULTS_FILE, 'w') { |fh| fh.puts test_data.join(' ') }
|
||||
end
|
||||
|
||||
it "should read the options" do
|
||||
found = false
|
||||
|
||||
@process_options = lambda { |*args|
|
||||
found = true if args.flatten == test_data
|
||||
}
|
||||
|
||||
read_defaults_file
|
||||
|
||||
found.should be_true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user