require 'spec_helper' module ActionView describe Template do describe "#initialize" do describe "with no overrides defined" do before(:all) do @template = ActionView::Template.new("
test
", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html}) end it "should initialize new template object" do @template.is_a?(ActionView::Template).should == true end it "should return unmodified source" do @template.source.should == "test
" end end describe "with a single remove override defined" do before(:all) do Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :remove => "p", :text => "test
<%= raw(text) %>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html}) end it "should return modified source" do @template.source.should == "<%= raw(text) %>" end end describe "with a single replace override defined" do before(:all) do Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "p", :text => "test
", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html}) end it "should return modified source" do @template.source.should == "