ensure files are not required twice, fixes #10 (h/t @dnagir)
This commit is contained in:
parent
46d1027982
commit
c29757ad9f
@ -98,7 +98,7 @@ module Jasmine
|
|||||||
data[searches].collect do |search|
|
data[searches].collect do |search|
|
||||||
path = search
|
path = search
|
||||||
path = File.join(data[root], path) if data[root]
|
path = File.join(data[root], path) if data[root]
|
||||||
found_files = Dir[path]
|
found_files = Dir[path] - @files
|
||||||
|
|
||||||
@files += found_files
|
@files += found_files
|
||||||
|
|
||||||
|
@ -24,13 +24,14 @@ describe Jasmine::FilesList do
|
|||||||
let(:src_dir) { 'src' }
|
let(:src_dir) { 'src' }
|
||||||
let(:spec_dir) { 'spec' }
|
let(:spec_dir) { 'spec' }
|
||||||
|
|
||||||
|
let(:first_file) { File.join(src_dir, 'js/first_file.js') }
|
||||||
let(:src_file) { File.join(src_dir, 'js/src_file.js') }
|
let(:src_file) { File.join(src_dir, 'js/src_file.js') }
|
||||||
let(:spec_file) { File.join(spec_dir, 'spec_file_spec.js') }
|
let(:spec_file) { File.join(spec_dir, 'spec_file_spec.js') }
|
||||||
let(:helper_file) { File.join(spec_dir, 'helper/helper_file.js') }
|
let(:helper_file) { File.join(spec_dir, 'helper/helper_file.js') }
|
||||||
let(:stylesheet_file) { File.join(src_dir, 'stylesheet/blah.css') }
|
let(:stylesheet_file) { File.join(src_dir, 'stylesheet/blah.css') }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
[ src_file, spec_file, helper_file, stylesheet_file ].each do |file|
|
[ first_file, src_file, spec_file, helper_file, stylesheet_file ].each do |file|
|
||||||
File.open(file, 'w')
|
File.open(file, 'w')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -38,7 +39,7 @@ describe Jasmine::FilesList do
|
|||||||
let(:config) { {
|
let(:config) { {
|
||||||
'src_dir' => src_dir,
|
'src_dir' => src_dir,
|
||||||
'spec_dir' => spec_dir,
|
'spec_dir' => spec_dir,
|
||||||
'src_files' => [ 'js/*.js' ],
|
'src_files' => [ 'js/first_file.js', 'js/*.js' ],
|
||||||
'spec_files' => [ '*_spec.js' ],
|
'spec_files' => [ '*_spec.js' ],
|
||||||
'helpers' => [ 'helper/*.js' ],
|
'helpers' => [ 'helper/*.js' ],
|
||||||
'stylesheets' => [ 'stylesheet/*.css' ]
|
'stylesheets' => [ 'stylesheet/*.css' ]
|
||||||
@ -46,6 +47,7 @@ describe Jasmine::FilesList do
|
|||||||
|
|
||||||
it 'should read the data from the jasmine.yml file and add the files' do
|
it 'should read the data from the jasmine.yml file and add the files' do
|
||||||
files_list.files.should == Jasmine::FilesList::DEFAULT_FILES + [
|
files_list.files.should == Jasmine::FilesList::DEFAULT_FILES + [
|
||||||
|
File.expand_path(first_file),
|
||||||
File.expand_path(src_file),
|
File.expand_path(src_file),
|
||||||
File.expand_path(stylesheet_file),
|
File.expand_path(stylesheet_file),
|
||||||
File.expand_path(helper_file),
|
File.expand_path(helper_file),
|
||||||
|
Loading…
Reference in New Issue
Block a user