Sha256: f4f3e645f7308535998df44e199203bba19634a4d018520736401985a2af050e

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

module Deface
  describe TemplateHelper do
    include Deface::TemplateHelper

    describe "load_template_source" do
      before do
        #stub view paths to be local spec/assets directory
        ActionController::Base.stub(:view_paths).and_return([File.join(File.dirname(__FILE__), '..', "assets")])
      end

      it "should return source for partial" do
        load_template_source("shared/_post", false).should == "<p>I'm from shared/post partial</p>\n<%= \"And I've got ERB\" %>\n"
      end

      it "should return source for template" do
        load_template_source("shared/person", false).should == "<p>I'm from shared/person template</p>\n<%= \"I've got ERB too\" %>\n"
      end

      it "should return source for namespaced template" do
        load_template_source("admin/posts/index", false).should == "<h1>Manage Posts</h1>\n"
      end

      it "should raise exception for non-existing file" do
        lambda { load_template_source("tester/_post", false) }.should raise_error(ActionView::MissingTemplate)
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
deface-0.5.2a spec/deface/template_helper_spec.rb
deface-0.5.6 spec/deface/template_helper_spec.rb
deface-0.5.5 spec/deface/template_helper_spec.rb
deface-0.5.4 spec/deface/template_helper_spec.rb
deface-0.5.3 spec/deface/template_helper_spec.rb
deface-0.5.2 spec/deface/template_helper_spec.rb
deface-0.5.1 spec/deface/template_helper_spec.rb
deface-0.5.0 spec/deface/template_helper_spec.rb