Sha256: 00a67a08b9a175aace4e23ea79bb56f55a966cbe04dd859286ccdb2d3594a8b3

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Merb::AbstractController do
  
  before(:all) do
    @abc = Merb::AbstractController
    @template = "/my/template/path/file.html.erb"
    @key = "/my/template/path/file.html"
  end
  
  before(:each) do 
    @abc.reset_template_path_cache!
  end
  
  after(:all) do
    Merb::BootLoader.load_controller_template_path_cache
    Merb::BootLoader.load_inline_helpers    
  end
  
  it "should add a template path" do
    @abc.add_path_to_template_cache(@template)
    @abc._template_path_cache.should include(@key)
    @abc._template_path_cache[@key].should == @template
  end
  
  it "should reset the template_path_cache" do
    @abc.add_path_to_template_cache(@template)
    @abc._template_path_cache.should_not be_empty
    @abc.reset_template_path_cache!
    @abc._template_path_cache.should be_empty
  end
  
  it "should return false if the template is the wrong format when adding" do
    @abc.add_path_to_template_cache("/my/path/to/template.rhtml").should == false
    @abc._template_path_cache.should_not include( "/my/path/to/template.rhtml")
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
merb-0.5.0 spec/merb/abstract_controller_spec.rb
merb-0.5.1 spec/merb/abstract_controller_spec.rb
merb-0.5.2 spec/merb/abstract_controller_spec.rb
merb-0.5.3 spec/merb/abstract_controller_spec.rb