fix issues for when not running under bundler
This commit is contained in:
parent
b6d94a5d0d
commit
e25d89962c
@ -20,7 +20,7 @@ module Jasmine::Headless
|
||||
Gem::Specification.each do |spec|
|
||||
path = File.join(spec.gem_dir, 'vendor/assets/javascripts')
|
||||
|
||||
@vendor_asset_paths << path if File.directory?(path)
|
||||
@vendor_asset_paths << path if File.directory?(path) && !@vendor_asset_paths.include?(path)
|
||||
end
|
||||
|
||||
@vendor_asset_paths
|
||||
@ -68,7 +68,11 @@ module Jasmine::Headless
|
||||
@potential_files_to_filter = []
|
||||
|
||||
self.class.default_files.each do |file|
|
||||
begin
|
||||
@required_files << sprockets_environment.find_asset(file, :bundle => false)
|
||||
rescue InvalidUniqueAsset => e
|
||||
raise StandardError.new("Not an asset: #{file}")
|
||||
end
|
||||
end
|
||||
|
||||
use_config! if config?
|
||||
@ -91,7 +95,7 @@ module Jasmine::Headless
|
||||
def search_paths
|
||||
return @search_paths if @search_paths
|
||||
|
||||
@search_paths = [ Jasmine::Core.path ]
|
||||
@search_paths = [ Jasmine::Core.path, Jasmine::Headless.root.join('vendor/assets/javascripts').to_s ]
|
||||
@search_paths += self.class.vendor_asset_paths
|
||||
@search_paths += src_dir.collect { |dir| File.expand_path(dir) }
|
||||
@search_paths += spec_dir.collect { |dir| File.expand_path(dir) }
|
||||
|
@ -1,7 +1,7 @@
|
||||
module Jasmine::Headless
|
||||
class UniqueAssetList < ::Array
|
||||
def <<(asset)
|
||||
raise StandardError.new("Not an asset") if !asset.respond_to?(:logical_path)
|
||||
raise InvalidUniqueAsset.new("Not an asset: #{asset.inspect}") if !asset.respond_to?(:logical_path)
|
||||
|
||||
super if !self.any? { |other| asset.logical_path == other.logical_path }
|
||||
end
|
||||
@ -10,5 +10,7 @@ module Jasmine::Headless
|
||||
self.collect(&:to_a).flatten
|
||||
end
|
||||
end
|
||||
|
||||
class InvalidUniqueAsset < StandardError ; end
|
||||
end
|
||||
|
||||
|
@ -67,9 +67,11 @@ describe Jasmine::Headless::FilesList do
|
||||
Jasmine::Headless::FilesList.stubs(:vendor_asset_paths).returns([])
|
||||
end
|
||||
|
||||
let(:vendor_path) { Jasmine::Headless.root.join('vendor/assets/javascripts').to_s }
|
||||
|
||||
context 'no vendored gem paths' do
|
||||
it 'should take the src dir and spec dirs' do
|
||||
files_list.search_paths.should == [ Jasmine::Core.path, File.expand_path(src_dir), File.expand_path(spec_dir) ]
|
||||
files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, File.expand_path(src_dir), File.expand_path(spec_dir) ]
|
||||
end
|
||||
end
|
||||
|
||||
@ -79,7 +81,7 @@ describe Jasmine::Headless::FilesList do
|
||||
end
|
||||
|
||||
it 'should add the vendor gem paths to the list' do
|
||||
files_list.search_paths.should == [ Jasmine::Core.path, path, File.expand_path(src_dir), File.expand_path(spec_dir) ]
|
||||
files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, path, File.expand_path(src_dir), File.expand_path(spec_dir) ]
|
||||
end
|
||||
end
|
||||
|
||||
@ -90,7 +92,7 @@ describe Jasmine::Headless::FilesList do
|
||||
let(:src_dir) { [ dir_1, dir_2 ] }
|
||||
|
||||
it 'should take the src dir and spec dirs' do
|
||||
files_list.search_paths.should == [ Jasmine::Core.path, File.expand_path(dir_1), File.expand_path(dir_2), File.expand_path(spec_dir) ]
|
||||
files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, File.expand_path(dir_1), File.expand_path(dir_2), File.expand_path(spec_dir) ]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user