Sha256: 041d75f2e023e06db17bf41aaf82594c154e7bdf3f4cb33427c3ff46069dee3b

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 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"
      end

      it "should return source for template" do
        load_template_source("shared/person", false).should == "<p>I'm from shared/person template</p>\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

2 entries across 2 versions & 1 rubygems

Version Path
deface-0.4.0 spec/deface/template_helper_spec.rb
deface-0.3.0 spec/deface/template_helper_spec.rb