spec/stache/handler_spec.rb in stache-0.1.0 vs spec/stache/handler_spec.rb in stache-0.2.0

- old
+ new

@@ -23,7 +23,19 @@ Object.send(:remove_const, :Profiles) end it "retuns Stache::View if it can't find none" do @handler.mustache_class_from_template(@template).should == Stache::View end + it "reraises error if loaded mustache_class raises a NameError" do + @template.stub!(:virtual_path).and_return("profiles/index") + module Profiles; end + # Emulate autoload behavior so the error gets raised upon const_get + Profiles.autoload :Index, File.join(File.dirname(__FILE__), "profile_autoload.rb") + + lambda { + @handler.mustache_class_from_template(@template) + }.should raise_error(NameError, "uninitialized constant Profiles::Index::Foo") + + Object.send(:remove_const, :Profiles) + end end -end \ No newline at end of file +end