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
11
features/bin/two_files_from_src_files.feature
Normal file
11
features/bin/two_files_from_src_files.feature
Normal file
@ -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 |
|
||||
|
10
features/steps/then/bin/following_files_loaded_in_order.rb
Normal file
10
features/steps/then/bin/following_files_loaded_in_order.rb
Normal file
@ -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,15 +227,15 @@ 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.each do |path|
|
||||
add_path(path, type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if type == 'spec_files'
|
||||
spec_filter.each { |path| add_path(path, type) }
|
||||
@ -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)
|
||||
|
2
spec/jasmine/two_files_from_src_files/app/app.js
Normal file
2
spec/jasmine/two_files_from_src_files/app/app.js
Normal file
@ -0,0 +1,2 @@
|
||||
//= require app-file
|
||||
//
|
7
spec/jasmine/two_files_from_src_files/jasmine.yml
Normal file
7
spec/jasmine/two_files_from_src_files/jasmine.yml
Normal 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
spec/jasmine/two_files_from_src_files/vendor/vendor-file.js
vendored
Normal file
0
spec/jasmine/two_files_from_src_files/vendor/vendor-file.js
vendored
Normal file
2
spec/jasmine/two_files_from_src_files/vendor/vendor.js
vendored
Normal file
2
spec/jasmine/two_files_from_src_files/vendor/vendor.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
//= require vendor-file
|
||||
//
|
Loading…
Reference in New Issue
Block a user