public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Search Repo:
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
Raise MissingThemesError if Site#theme is nil

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2682 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sun Jan 14 17:56:55 -0800 2007
commit  45893b3ad2bc5f28efcfe4777d80a53a6ecf4ed5
tree    c8682eb04e9dbca7cbe1ec9bd3ae4d22701ece98
parent  b9fee1e9fd368ac878193466d5c927c92ad70436
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 * SVN *
0
 
0
+* Raise MissingThemesError if Site#theme is nil
0
+
0
 * RIP: Site#search_layout
0
 
0
 * Add link_to_search_result filter that uses either a paged or blog permalink, depending on the search section.
...
124
125
126
127
 
128
129
130
...
124
125
126
 
127
128
129
130
0
@@ -124,7 +124,7 @@ class Site < ActiveRecord::Base
0
   end
0
 
0
   def theme
0
- @theme ||= themes[current_theme_path] || themes.first
0
+ @theme ||= themes[current_theme_path] || themes.first || raise(MissingThemesError.new(self))
0
   end
0
 
0
   def change_theme_to(new_theme_path)
...
50
51
52
 
 
 
 
 
 
 
 
53
54
55
...
50
51
52
53
54
55
56
57
58
59
60
61
62
63
0
@@ -50,6 +50,14 @@ class MissingTemplateError < StandardError
0
   end
0
 end
0
 
0
+class MissingThemesError < StandardError
0
+ attr_reader :site
0
+ def initialize(site)
0
+ @site = site
0
+ super "No themes found in '#{site.theme_path.to_s}/#{site.current_theme_path}'. This must be set correctly in the site settings."
0
+ end
0
+end
0
+
0
 class ThemeError < StandardError
0
   attr_reader :theme
0
   def initialize(theme, message)
...
52
53
54
 
 
 
 
 
 
 
55
...
52
53
54
55
56
57
58
59
60
61
62
0
@@ -52,4 +52,11 @@ context "Theme" do
0
     end
0
     assert !dest.exist?
0
   end
0
+
0
+ specify "should raise MissingThemesError on missing themes" do
0
+ site = Site.new
0
+ site.stubs(:themes).returns([])
0
+ site.stubs(:current_theme_path).returns(0)
0
+ assert_raises(MissingThemesError) { site.theme }
0
+ end
0
 end

Comments

    No one has commented yet.