<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,6 @@
 class MessagesController &lt; ApplicationController
   before_filter :login_required 
+  before_filter :can_read_messages?
   before_filter :store_location, :only =&gt; [:index, :sent]
   
   # Show messages for the currently logged in user.
@@ -63,4 +64,12 @@ class MessagesController &lt; ApplicationController
   def sent
     @messages = current_user.outbox_messages
   end
+  
+  private
+    def can_read_messages?
+      if !current_user.can?(:read_messages)
+        flash[:notice] = t(:you_are_not_allowed_to_read_messages)
+        redirect_to root_path
+      end
+    end
 end</diff>
      <filename>app/controllers/messages_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -41,7 +41,7 @@ class Post &lt; ActiveRecord::Base
   end
   
   def stop_spam
-    if (!user.posts.last.nil? &amp;&amp; user.posts.last.created_at &gt; Time.now - TIME_BETWEEN_POSTS) || !user.can?(:ignore_flood_limit)
+    if (!user.posts.last.nil? &amp;&amp; user.posts.last.created_at &gt; Time.now - TIME_BETWEEN_POSTS) &amp;&amp; !user.can?(:ignore_flood_limit)
       errors.add_to_base(&quot;You can only post once every #{distance_of_time_in_words(Time.now, Time.now - TIME_BETWEEN_POSTS)}&quot;) and return false
     end
   end</diff>
      <filename>app/models/post.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,9 @@
 class ThemesLoader
   def initialize
-    if Theme.count != Dir.entries(THEMES_DIRECTORY).size
+    themes = Dir.entries(THEMES_DIRECTORY).reject { |theme| theme =~ /^\./ }
+    if Theme.count != themes.size
       Theme.delete_all  
-      (Dir.entries(THEMES_DIRECTORY).delete_if { |e| /^\./.match(e) || !File.directory?(File.join(THEMES_DIRECTORY, e))}).each { |theme| Theme.create(:name =&gt; theme) } 
+      (themes.delete_if { |e| /^\./.match(e) || !File.directory?(File.join(THEMES_DIRECTORY, e))}).each { |theme| Theme.create(:name =&gt; theme) } 
     end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/themes_loader.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,8 @@ describe ForumsController do
     @forums = [@forum]
     @test_category = categories(:test)
     @admin_category = categories(:admins_only)
+    @everybody = forums(:everybody)
+    @admins_only = forums(:admins_only)
   end
   
   describe &quot;plebian&quot; do
@@ -22,6 +24,7 @@ describe ForumsController do
       Forum.should_receive(:without_category).and_return(@forums)
       @forums.should_receive(:without_parent).and_return(@forums)
       get 'index'
+      response.should render_template(&quot;index&quot;)
     end
     
     it &quot;should show a list of forums inside a specific category&quot; do
@@ -29,6 +32,7 @@ describe ForumsController do
       @category.should_receive(:forums).and_return(@forums)
       @forums.should_receive(:without_parent).and_return(@forums)
       get 'index', :category_id =&gt; @test_category.id
+      response.should render_template(&quot;index&quot;)
     end
     
     it &quot;should not be able to see anything inside a restricted category&quot; do
@@ -37,6 +41,49 @@ describe ForumsController do
       response.should redirect_to(root_path)
     end
     
+    it &quot;should be able to see the everybody forum&quot; do
+      get 'show', :id =&gt; @everybody.id
+      response.should render_template(&quot;show&quot;)
+    end
+    
+    it &quot;should not be able to see the admins only forum&quot; do
+      get 'show', :id =&gt; @admins_only.id
+      flash[:notice].should eql(t(:forum_permission_denied))
+      response.should redirect_to(forums_path)
+    end
+    
+  end
+  
+  describe &quot;admin&quot; do
+    before do
+      login_as(:administrator)
+    end
+    
+    it &quot;should be able to see the everybody forum&quot; do
+      get 'show', :id =&gt; @everybody.id
+      response.should render_template(&quot;show&quot;)
+    end
+    
+    it &quot;should be able to see the admins only forum&quot; do
+      get 'show', :id =&gt; @admins_only.id
+      response.should render_template(&quot;show&quot;)
+    end
+    
+    it &quot;should be able to see forums for the test category&quot; do
+      Category.should_receive(:find).and_return(@category)
+      @category.should_receive(:forums).and_return(@forums)
+      @forums.should_receive(:without_parent).and_return(@forums)
+      get 'index', :category_id =&gt; @test_category.id
+      response.should render_template(&quot;index&quot;)
+    end
+    
+    it &quot;should be able to see the forums for the admin category&quot; do
+      Category.should_receive(:find).and_return(@category)
+      @category.should_receive(:forums).and_return(@forums)
+      @forums.should_receive(:without_parent).and_return(@forums)
+      get 'index', :category_id =&gt; @admin_category.id
+      response.should render_template(&quot;index&quot;)
+    end
   end
   
 end</diff>
      <filename>spec/controllers/forums_controller_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>efe82b82c636889bcd8f974ab526a319633decbb</id>
    </parent>
  </parents>
  <author>
    <name>Ryan Bigg</name>
    <email>radarlistener@gmail.com</email>
  </author>
  <url>http://github.com/radar/rboard/commit/94021bad4d4beb1e3d069c4f9efcdca800bdfaaa</url>
  <id>94021bad4d4beb1e3d069c4f9efcdca800bdfaaa</id>
  <committed-date>2009-04-03T20:27:10-07:00</committed-date>
  <authored-date>2009-04-03T20:26:08-07:00</authored-date>
  <message>Fix themes loader and specs</message>
  <tree>089e2cefb9c9a162e7cabfaa9df27ba0bb940f40</tree>
  <committer>
    <name>Ryan Bigg</name>
    <email>radarlistener@gmail.com</email>
  </committer>
</commit>
