half-fix for #19, ensure coffeescript files have newlines separating them

This commit is contained in:
John Bintz 2011-06-19 14:51:47 -04:00
parent ff792b81f6
commit 3b71a0355b
2 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ module Jasmine
def ensure_coffeescript_run!(files) def ensure_coffeescript_run!(files)
data = StringIO.new data = StringIO.new
files.each { |file| data << File.read(file) } files.each { |file| data << File.read(file) << "\n" }
data.rewind data.rewind
%{<script type="text/javascript">#{CoffeeScript.compile(data)}</script>} %{<script type="text/javascript">#{CoffeeScript.compile(data)}</script>}

View File

@ -129,7 +129,7 @@ describe Jasmine::FilesList do
File.open('test.coffee', 'w') { |fh| fh.print "first" } File.open('test.coffee', 'w') { |fh| fh.print "first" }
CoffeeScript.stubs(:compile).with() { |field| field.read == "first" }.returns("i compiled") CoffeeScript.stubs(:compile).with() { |field| field.read == "first\n" }.returns("i compiled")
end end
context '#files_to_html' do context '#files_to_html' do
@ -172,7 +172,7 @@ describe Jasmine::FilesList do
context '#files_to_html' do context '#files_to_html' do
it "should create the right HTML" do it "should create the right HTML" do
CoffeeScript.stubs(:compile).with() { |field| field.read == "firstsecond" }.returns("i compiled") CoffeeScript.stubs(:compile).with() { |field| field.read == "first\nsecond\n" }.returns("i compiled")
files_list.files_to_html.should == [ files_list.files_to_html.should == [
%{<script type="text/javascript" src="test.js"></script>}, %{<script type="text/javascript" src="test.js"></script>},
@ -184,7 +184,7 @@ describe Jasmine::FilesList do
context '#filtered_files_to_html' do context '#filtered_files_to_html' do
it "should create the right HTML" do it "should create the right HTML" do
CoffeeScript.stubs(:compile).with() { |field| field.read == "first" }.returns("i compiled") CoffeeScript.stubs(:compile).with() { |field| field.read == "first\n" }.returns("i compiled")
files_list.filtered_files_to_html.should == [ files_list.filtered_files_to_html.should == [
%{<script type="text/javascript" src="test.js"></script>}, %{<script type="text/javascript" src="test.js"></script>},