ensure all paths are expanded before working with them, should fix johnbintz/guard-jasmine-headless-webkit #10

This commit is contained in:
John Bintz 2011-10-17 09:25:11 -04:00
parent 951cf80f09
commit 42ed3e6013
2 changed files with 17 additions and 4 deletions

View File

@ -100,7 +100,15 @@ module Jasmine
end
def spec_filter
@spec_filter ||= (@options[:only] ? @options[:only].collect { |path| Dir[path] }.flatten : [])
return @spec_filter if @spec_filter
@spec_filter = begin
if @options[:only]
@options[:only].collect { |path| expanded_dir(path) }.flatten
else
[]
end
end
end
def use_config!
@ -112,7 +120,7 @@ module Jasmine
data[searches].flatten.collect do |search|
path = search
path = File.join(data[root], path) if data[root]
found_files = Dir[path] - @files
found_files = expanded_dir(path) - @files
@files += found_files
@ -136,6 +144,10 @@ module Jasmine
def config?
@options[:config]
end
def expanded_dir(path)
Dir[path].collect { |file| File.expand_path(file) }
end
end
end

View File

@ -1,4 +1,5 @@
require 'spec_helper'
require 'tempfile'
describe "jasmine-headless-webkit" do
let(:report) { 'spec/report.txt' }
@ -122,8 +123,8 @@ describe "jasmine-headless-webkit" do
files = %x{bin/jasmine-headless-webkit -l -j spec/jasmine/success/success.yml}
$?.exitstatus.should == 0
files.lines.to_a.should include("./spec/jasmine/success/success.js\n")
files.lines.to_a.should include("./spec/jasmine/success/success_spec.js\n")
files.lines.to_a.should include(File.expand_path("./spec/jasmine/success/success.js\n"))
files.lines.to_a.should include(File.expand_path("./spec/jasmine/success/success_spec.js\n"))
end
end