spec/stache/mustache/handler_spec.rb in stache-1.1.0 vs spec/stache/mustache/handler_spec.rb in stache-1.1.1
- old
+ new
@@ -14,16 +14,26 @@
it "returns the appropriate mustache class" do
class HelloWorld < Stache::Mustache::View; end
@handler.mustache_class_from_template(@template).should == HelloWorld
Object.send(:remove_const, :HelloWorld)
end
+ it "handles templates with dashes in the filename" do
+ class HelloWorld < Stache::Mustache::View; end
+ @template.stub(:virtual_path).and_return 'hello-world'
+ @handler.mustache_class_from_template(@template).should == HelloWorld
+ Object.send(:remove_const, :HelloWorld)
+ end
it "is clever about folders and such" do
@template.stub(:virtual_path).and_return("profiles/index")
module Profiles; class Index < Stache::Mustache::View; end; end
@handler.mustache_class_from_template(@template).should == Profiles::Index
Object.send(:remove_const, :Profiles)
end
it "retuns Stache::Mustache::View if it can't find none" do
+ @handler.mustache_class_from_template(@template).should == Stache::Mustache::View
+ end
+ it "handles nested paths" do
+ @template.stub(:virtual_path).and_return("profiles/sub/index")
@handler.mustache_class_from_template(@template).should == Stache::Mustache::View
end
it "reraises error if loaded mustache_class raises a NameError" do
@template.stub(:virtual_path).and_return("profiles/index")
module Profiles; end