2011-06-10 15:02:26 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
require 'jasmine/template_writer'
|
|
|
|
require 'fakefs/spec_helpers'
|
|
|
|
|
|
|
|
describe Jasmine::TemplateWriter do
|
|
|
|
describe '.write!' do
|
|
|
|
include FakeFS::SpecHelpers
|
|
|
|
|
2011-09-12 19:12:58 +00:00
|
|
|
before do
|
|
|
|
File.stubs(:read).returns(nil)
|
|
|
|
end
|
|
|
|
|
2011-06-10 15:02:26 +00:00
|
|
|
let(:files_list) { Jasmine::FilesList.new }
|
|
|
|
|
|
|
|
before do
|
|
|
|
files_list.files << 'file.js'
|
|
|
|
files_list.filtered_files << 'file.js'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'no filter' do
|
|
|
|
it 'should write one file' do
|
|
|
|
Jasmine::TemplateWriter.write!(files_list).should == [
|
|
|
|
"specrunner.#{$$}.html"
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'filtered files' do
|
|
|
|
before do
|
|
|
|
files_list.files << 'file2.js'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should write two files' do
|
|
|
|
Jasmine::TemplateWriter.write!(files_list).should == [
|
|
|
|
"specrunner.#{$$}.filter.html", "specrunner.#{$$}.html"
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|