<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,6 +5,8 @@ class FreeDays &lt; Application
   def index
     only_provides :ics
     
+    raise Forbidden unless params[:access_key] == Setting.free_days_access_key
+    
     render FreeDay.to_ical
   end
 </diff>
      <filename>app/controllers/free_days.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,15 +3,28 @@ require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
 describe FreeDays do
   
   describe &quot;.index&quot; do
+    before { Setting.stub!(:free_days_access_key =&gt; 'access_key') }
     
-    it &quot;should be successful&quot; do
-      FreeDay.stub!(:to_ical =&gt; &quot;iCalFileContent&quot;)
-      dispatch_to(FreeDays, :index).should be_successful
+    context &quot;with valid :access_key&quot; do
+      
+      it &quot;should be successful&quot; do
+        FreeDay.stub!(:to_ical =&gt; &quot;iCalFileContent&quot;)
+        dispatch_to(FreeDays, :index, :access_key =&gt; 'access_key').should be_successful
+      end
+    
+      it &quot;should render free days iCalendar&quot; do
+        FreeDay.should_receive(:to_ical).and_return(&quot;iCalFileContent&quot;)
+        dispatch_to(FreeDays, :index, :access_key =&gt; 'access_key').body.should == &quot;iCalFileContent&quot;
+      end
+      
     end
     
-    it &quot;should render free days iCalendar&quot; do
-      FreeDay.should_receive(:to_ical).and_return(&quot;iCalFileContent&quot;)
-      dispatch_to(FreeDays, :index).body.should == &quot;iCalFileContent&quot;
+    context &quot;with invalid :access_key&quot; do
+      
+      it &quot;should be successful&quot; do
+        lambda { dispatch_to(FreeDays, :index, :access_key =&gt; 'invalid') }.should raise_error(Merb::ControllerExceptions::Forbidden)
+      end
+      
     end
 
   end</diff>
      <filename>spec/controllers/free_days_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5cd1b70377fb1229c243eee344418866af62916a</id>
    </parent>
  </parents>
  <author>
    <name>Jacek Mikrut</name>
    <email>jacek.mikrut@llp.pl</email>
  </author>
  <url>http://github.com/LunarLogicPolska/rubytime/commit/456be8201f3ad85b1477f3f2bc12dccad0fcc6a6</url>
  <id>456be8201f3ad85b1477f3f2bc12dccad0fcc6a6</id>
  <committed-date>2009-09-25T06:55:07-07:00</committed-date>
  <authored-date>2009-09-25T06:55:07-07:00</authored-date>
  <message>Restricted access to free days iCal feed, now :access_key is required.</message>
  <tree>ac361ece718144fe8c491fcae2221029680eefc0</tree>
  <committer>
    <name>Jacek Mikrut</name>
    <email>jacek.mikrut@llp.pl</email>
  </committer>
</commit>
