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
|
end
|
||||||
|
|
||||||
def add_files(patterns, type, dirs)
|
def add_files(patterns, type, dirs)
|
||||||
dirs.product(patterns).each do |search|
|
patterns.each do |pattern|
|
||||||
files = expanded_dir(File.join(*search))
|
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|
|
files.each do |path|
|
||||||
add_path(path, type)
|
add_path(path, type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if type == 'spec_files'
|
if type == 'spec_files'
|
||||||
spec_filter.each { |path| add_path(path, type) }
|
spec_filter.each { |path| add_path(path, type) }
|
||||||
@ -271,7 +271,7 @@ module Jasmine::Headless
|
|||||||
end
|
end
|
||||||
|
|
||||||
def src_dir
|
def src_dir
|
||||||
@src_dir ||= config_dir_or_pwd('src_dir')
|
@src_dir ||= config_dir_or_pwd('src_dir') + asset_paths
|
||||||
end
|
end
|
||||||
|
|
||||||
def spec_dir
|
def spec_dir
|
||||||
@ -279,7 +279,7 @@ module Jasmine::Headless
|
|||||||
end
|
end
|
||||||
|
|
||||||
def asset_paths
|
def asset_paths
|
||||||
@asset_paths ||= config_dir_or_pwd('asset_paths')
|
@asset_paths ||= config_dir('asset_paths')
|
||||||
end
|
end
|
||||||
|
|
||||||
def spec_file_searches
|
def spec_file_searches
|
||||||
@ -287,9 +287,15 @@ module Jasmine::Headless
|
|||||||
end
|
end
|
||||||
|
|
||||||
def config_dir_or_pwd(dir)
|
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
|
end
|
||||||
|
|
||||||
def filter_for_requested_specs(files)
|
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