From 00c4a30481cf0b4b519eda54232ec39db877e95f Mon Sep 17 00:00:00 2001
From: John Bintz <john@coswellproductions.com>
Date: Tue, 21 Jun 2011 06:49:00 -0400
Subject: [PATCH] fix railtie for rails 3.1, fixes #22

---
 lib/jasmine/headless/railtie.rb | 29 -----------------------------
 lib/jasmine/headless/task.rb    | 29 +++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/lib/jasmine/headless/railtie.rb b/lib/jasmine/headless/railtie.rb
index 8c3908f..02441c4 100644
--- a/lib/jasmine/headless/railtie.rb
+++ b/lib/jasmine/headless/railtie.rb
@@ -1,25 +1,5 @@
 require 'jasmine/headless/task'
 
-module Digest
-  class JasmineTest
-    def self.file(file)
-      new
-    end
-
-    def file(file)
-      self
-    end
-    
-    def hexdigest
-      'test'
-    end
-
-    def update(prefix)
-      self
-    end
-  end
-end
-
 module Jasmine
   module Headless
     class Railtie < Rails::Railtie
@@ -27,15 +7,6 @@ module Jasmine
         Jasmine::Headless::Task.new do |t|
           t.colors = true
         end
-
-        if Rails.version >= "3.1.0"
-          desc 'Force generate static assets without an MD5 hash, all assets end with -test.<ext>'
-          task 'assets:precompile:for_testing' => :environment do
-            Rails.application.assets.digest_class = Digest::JasmineTest
-
-            Rake::Task['assets:precompile'].invoke
-          end
-        end
       end
     end
   end
diff --git a/lib/jasmine/headless/task.rb b/lib/jasmine/headless/task.rb
index 6288c9c..05ae7cc 100644
--- a/lib/jasmine/headless/task.rb
+++ b/lib/jasmine/headless/task.rb
@@ -1,5 +1,25 @@
 require 'jasmine/headless/runner'
 
+module Digest
+  class JasmineTest
+    def self.file(file)
+      new
+    end
+
+    def file(file)
+      self
+    end
+    
+    def hexdigest
+      'test'
+    end
+
+    def update(prefix)
+      self
+    end
+  end
+end
+
 module Jasmine
   module Headless
     class Task
@@ -22,6 +42,15 @@ module Jasmine
             :jasmine_config => @jasmine_config
           )
         end
+
+        if Rails.version >= "3.1.0"
+          desc 'Force generate static assets without an MD5 hash, all assets end with -test.<ext>'
+          task 'assets:precompile:for_testing' => :environment do
+            Rails.application.assets.digest_class = Digest::JasmineTest
+
+            Rake::Task['assets:precompile'].invoke
+          end
+        end
       end
     end
   end