Skip to content

Commit

Permalink
Bugfix: Ignore bad constant names when autoloading
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Oct 28, 2009
1 parent e4234be commit 1ff27cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.2 (2009-??-??)

* Bugfix: Ignore bad constant names when autoloading

## 0.4.1 (2009-10-27)

* Partials now respect the `view_namespace` setting.
Expand Down
2 changes: 2 additions & 0 deletions lib/mustache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ def self.view_class(name)
else
Mustache
end
rescue NameError
Mustache
end

# Should an exception be raised when we cannot find a corresponding method
Expand Down
4 changes: 4 additions & 0 deletions test/autoloading_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ def test_namespaced_partial_autoload
My opinion: Victory!
end_render
end

def test_bad_constant_name
assert_equal Mustache, Mustache.view_class(404)
end
end

0 comments on commit 1ff27cc

Please sign in to comment.