make sure src_files can also be loaded from other asset paths, should fix problem found by @christiannelson
This commit is contained in:
parent
0d4550524f
commit
142a0c974b
|
@ -0,0 +1,11 @@
|
|||
Feature: Two files from source files
|
||||
Scenario: Files are ordered directly
|
||||
Given I have a test suite
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/two_files_from_src_files/jasmine.yml -l`
|
||||
Then the exit status should be 0
|
||||
And the following files should be loaded in order:
|
||||
| vendor/vendor-file.js |
|
||||
| vendor/vendor.js |
|
||||
| app/app-file.js |
|
||||
| app/app.js |
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
Then /^the following files should be loaded in order:$/ do |table|
|
||||
files = table.raw.flatten
|
||||
|
||||
@output.lines.collect(&:strip).each do |line|
|
||||
files.shift if line[files.first]
|
||||
end
|
||||
|
||||
files.should be_empty
|
||||
end
|
||||
|
|
@ -227,13 +227,13 @@ module Jasmine::Headless
|
|||
end
|
||||
|
||||
def add_files(patterns, type, dirs)
|
||||
dirs.product(patterns).each do |search|
|
||||
files = expanded_dir(File.join(*search))
|
||||
patterns.each do |pattern|
|
||||
dirs.collect { |dir| expanded_dir(File.join(dir, pattern)) }.each do |files|
|
||||
files.sort! { |a, b| Kernel.rand(3) - 1 } if type == 'spec_files'
|
||||
|
||||
files.sort! { |a, b| Kernel.rand(3) - 1 } if type == 'spec_files'
|
||||
|
||||
files.each do |path|
|
||||
add_path(path, type)
|
||||
files.each do |path|
|
||||
add_path(path, type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -271,7 +271,7 @@ module Jasmine::Headless
|
|||
end
|
||||
|
||||
def src_dir
|
||||
@src_dir ||= config_dir_or_pwd('src_dir')
|
||||
@src_dir ||= config_dir_or_pwd('src_dir') + asset_paths
|
||||
end
|
||||
|
||||
def spec_dir
|
||||
|
@ -279,7 +279,7 @@ module Jasmine::Headless
|
|||
end
|
||||
|
||||
def asset_paths
|
||||
@asset_paths ||= config_dir_or_pwd('asset_paths')
|
||||
@asset_paths ||= config_dir('asset_paths')
|
||||
end
|
||||
|
||||
def spec_file_searches
|
||||
|
@ -287,9 +287,15 @@ module Jasmine::Headless
|
|||
end
|
||||
|
||||
def config_dir_or_pwd(dir)
|
||||
found_dir = (@options[:config] && @options[:config][dir]) || Dir.pwd
|
||||
if (found = config_dir(dir)).empty?
|
||||
found = [ Dir.pwd ]
|
||||
end
|
||||
|
||||
[ found_dir ].flatten.collect { |dir| File.expand_path(dir) }
|
||||
found
|
||||
end
|
||||
|
||||
def config_dir(dir)
|
||||
[ @options[:config] && @options[:config][dir] ].flatten.compact.collect { |dir| File.expand_path(dir) }
|
||||
end
|
||||
|
||||
def filter_for_requested_specs(files)
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
//= require app-file
|
||||
//
|
|
@ -0,0 +1,7 @@
|
|||
src_dir: spec/jasmine/two_files_from_src_files/app
|
||||
|
||||
asset_paths:
|
||||
- "spec/jasmine/two_files_from_src_files/vendor"
|
||||
|
||||
src_files: [ 'vendor.js', 'app.js' ]
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
//= require vendor-file
|
||||
//
|
Loading…
Reference in New Issue