Skip to content

Commit

Permalink
Support the inclusion of files that exist only via the asset pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Davis W. Frank & Rajan Agaskar committed Nov 4, 2011
1 parent 0a2a9d2 commit 14e8ee9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions generators/jasmine/templates/jasmine-example/SpecRunner.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<script type="text/javascript" src="lib/jasmine-1.1.0.rc1/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.1.0.rc1/jasmine-html.js"></script>

<!-- include spec files here... -->
<!-- include source files here... -->
<script type="text/javascript" src="spec/SpecHelper.js"></script>
<script type="text/javascript" src="spec/PlayerSpec.js"></script>

<!-- include source files here... -->
<!-- include spec files here... -->
<script type="text/javascript" src="src/Player.js"></script>
<script type="text/javascript" src="src/Song.js"></script>

Expand Down
4 changes: 2 additions & 2 deletions lib/jasmine/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def match_files(dir, patterns)
chosen, negated = [positive, negative].collect do |patterns|
patterns.collect do |pattern|
matches = Dir.glob(File.join(dir, pattern.gsub(/^!/,'')))
matches.collect {|f| f.sub("#{dir}/", "")}.sort
matches.empty? && !(pattern =~ /\*|^\!/) ? pattern : matches.collect {|f| f.sub("#{dir}/", "")}.sort
end.flatten.uniq
end
chosen - negated
Expand Down Expand Up @@ -159,4 +159,4 @@ def stylesheets
end
end
end
end
end
1 change: 0 additions & 1 deletion lib/jasmine/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def call(env)
def self.app(config)
Rack::Builder.app do
use Rack::Head

if Jasmine::Dependencies.rails_3_asset_pipeline?
map('/assets') do
run Rails.application.assets
Expand Down
13 changes: 13 additions & 0 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,18 @@
end
end

describe "should permit explicity-declared filenames to pass through regardless of their existence" do
before(:each) do
Dir.stub!(:glob).and_return { |glob_string| [] }
fake_config = Hash.new.stub!(:[]).and_return { |x| ["file1.ext", "!file2.ext", "**/*file3.ext"] }
@config.stub!(:simple_config).and_return(fake_config)
end

it "should contain explicitly files" do
@config.src_files.should == ["file1.ext"]
end
end

describe "should allow .gitignore style negation (!pattern)" do
before(:each) do
Dir.stub!(:glob).and_return { |glob_string| [glob_string] }
Expand Down Expand Up @@ -305,4 +317,5 @@ def stub_env_hash(hash)
end
end
end

end

0 comments on commit 14e8ee9

Please sign in to comment.