also provide asset_paths in jasmine.yml for adding paths
This commit is contained in:
parent
e25d89962c
commit
6ad4bdaec0
@ -98,6 +98,7 @@ module Jasmine::Headless
|
||||
@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 += asset_paths.collect { |dir| File.expand_path(dir) }
|
||||
@search_paths += spec_dir.collect { |dir| File.expand_path(dir) }
|
||||
|
||||
@search_paths
|
||||
@ -232,6 +233,10 @@ module Jasmine::Headless
|
||||
@spec_dir ||= config_dir_or_pwd('spec_dir')
|
||||
end
|
||||
|
||||
def asset_paths
|
||||
@asset_paths ||= config_dir_or_pwd('asset_paths')
|
||||
end
|
||||
|
||||
def spec_file_searches
|
||||
@searches['spec_files']
|
||||
end
|
||||
|
@ -56,11 +56,13 @@ describe Jasmine::Headless::FilesList do
|
||||
|
||||
let(:config) { {
|
||||
'src_dir' => src_dir,
|
||||
'spec_dir' => spec_dir
|
||||
'spec_dir' => spec_dir,
|
||||
'asset_paths' => asset_paths
|
||||
} }
|
||||
|
||||
let(:src_dir) { 'src dir' }
|
||||
let(:spec_dir) { 'spec dir' }
|
||||
let(:asset_paths) { [] }
|
||||
let(:path) { 'path' }
|
||||
|
||||
before do
|
||||
@ -85,16 +87,27 @@ describe Jasmine::Headless::FilesList do
|
||||
end
|
||||
end
|
||||
|
||||
context 'src_dir is an array' do
|
||||
context 'multiple dirs' do
|
||||
let(:dir_1) { 'dir 1' }
|
||||
let(:dir_2) { 'dir 2' }
|
||||
|
||||
context 'src_dir is an array' 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, vendor_path, File.expand_path(dir_1), File.expand_path(dir_2), File.expand_path(spec_dir) ]
|
||||
end
|
||||
end
|
||||
|
||||
context 'asset_paths has entries' do
|
||||
let(:src_dir) { dir_1 }
|
||||
let(:asset_paths) { [ dir_2 ] }
|
||||
|
||||
it 'should take the src dir and spec dirs' do
|
||||
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
|
||||
end
|
||||
|
||||
describe '.vendor_asset_paths' do
|
||||
|
Loading…
Reference in New Issue
Block a user