<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,27 @@
 require 'cloudkit'
+
+# Test-mode-only datastore reset middleware
+# Clears store on POST to /test_reset
+class TestResetMiddleware
+  def initialize(app)
+    @app = app
+  end
+
+  def call(env)
+    if match_route?(env)
+      CloudKit.storage_adapter.clear
+      [200, {'Content-Type' =&gt; 'text/html', 'Content-Length' =&gt; '2'}, ['OK']]
+    else
+      @app.call(env)
+    end
+  end
+
+  def match_route?(env)
+    env['PATH_INFO'] == '/test_reset' &amp;&amp; env['REQUEST_METHOD'] == 'POST'
+  end
+end
+
 expose :notes, :things # host RESTful &quot;notes&quot; and &quot;things&quot; JSON APIs
+use TestResetMiddleware
 use Rack::Static, :urls =&gt; ['/'] # serve the plugin and test files
 run lambda { |env| [404, {'Content-Type' =&gt; 'text/html', 'Content-Length' =&gt; '9'}, ['Not Found']] } # appease rack</diff>
      <filename>config.ru</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>50b8f813250777585e1a70c3e424dd7d775c801d</id>
    </parent>
  </parents>
  <author>
    <name>Jon Crosby</name>
    <email>jon@joncrosby.me</email>
  </author>
  <url>http://github.com/jcrosby/jquery-cloudkit/commit/c8024672bb3cd82e909d28c99cee4eb6bba19a8b</url>
  <id>c8024672bb3cd82e909d28c99cee4eb6bba19a8b</id>
  <committed-date>2009-03-30T21:22:41-07:00</committed-date>
  <authored-date>2009-03-30T21:22:41-07:00</authored-date>
  <message>Add TestResetMiddleware</message>
  <tree>8c5052af8faaca70468dcfb262359e2bd9b75704</tree>
  <committer>
    <name>Jon Crosby</name>
    <email>jon@joncrosby.me</email>
  </committer>
</commit>
