2011-11-23 14:35:44 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Jasmine::Headless::JSTemplate do
|
|
|
|
include FakeFS::SpecHelpers
|
|
|
|
|
|
|
|
let(:template) { described_class.new(file) { data } }
|
|
|
|
let(:file) { 'file' }
|
|
|
|
let(:data) { 'data' }
|
|
|
|
|
|
|
|
subject { template.render }
|
|
|
|
|
|
|
|
before do
|
|
|
|
File.open(file, 'wb') if file
|
|
|
|
end
|
|
|
|
|
|
|
|
context "no file'" do
|
|
|
|
let(:file) { nil }
|
|
|
|
|
|
|
|
it { should == data }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'file' do
|
|
|
|
it { should == %{<script type="text/javascript" src="#{file}"></script>} }
|
|
|
|
end
|
|
|
|
|
2011-11-29 15:56:02 +00:00
|
|
|
context 'script as first thing' do
|
|
|
|
let(:data) { '<script type="text/javascript"' }
|
2011-11-23 14:35:44 +00:00
|
|
|
|
|
|
|
it { should == data }
|
|
|
|
end
|
|
|
|
end
|