From cc619466dffaa9f31d78a7aca6ba2917b412df7a Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 12 Jun 2011 10:40:18 -0400 Subject: [PATCH 1/3] punch sprockets in the duck to make it compile files we can actually test --- lib/jasmine/headless/railtie.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/jasmine/headless/railtie.rb b/lib/jasmine/headless/railtie.rb index 02441c4..ee857a6 100644 --- a/lib/jasmine/headless/railtie.rb +++ b/lib/jasmine/headless/railtie.rb @@ -1,5 +1,25 @@ 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 @@ -7,6 +27,15 @@ 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.' + task 'assets:precompile:for_testing' => :environment do + Rails.application.assets.instance_variable_set(:@digest_class, Digest::JasmineTest) + + Rake::Task['assets:precompile'].invoke + end + end end end end From ac7cf07d5d3930d99274be990d2b06fe9324015b Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 13 Jun 2011 07:50:15 -0400 Subject: [PATCH 2/3] the duck doesn't need to be punched as hard as I thought... --- lib/jasmine/headless/railtie.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jasmine/headless/railtie.rb b/lib/jasmine/headless/railtie.rb index ee857a6..8c3908f 100644 --- a/lib/jasmine/headless/railtie.rb +++ b/lib/jasmine/headless/railtie.rb @@ -31,7 +31,7 @@ module Jasmine if Rails.version >= "3.1.0" desc 'Force generate static assets without an MD5 hash, all assets end with -test.' task 'assets:precompile:for_testing' => :environment do - Rails.application.assets.instance_variable_set(:@digest_class, Digest::JasmineTest) + Rails.application.assets.digest_class = Digest::JasmineTest Rake::Task['assets:precompile'].invoke end From f3e63c30314e7f708bd1b3e1ef6a2aa21e14349b Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 13 Jun 2011 08:14:24 -0400 Subject: [PATCH 3/3] that object doesn't exist --- jasmine/jasmine.headless-reporter.coffee | 2 +- jasmine/jasmine.headless-reporter.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jasmine/jasmine.headless-reporter.coffee b/jasmine/jasmine.headless-reporter.coffee index da553c5..d34e792 100644 --- a/jasmine/jasmine.headless-reporter.coffee +++ b/jasmine/jasmine.headless-reporter.coffee @@ -1,5 +1,5 @@ if !jasmine? - throw new Exception("jasmine not laoded!") + throw new Error("jasmine not laoded!") class HeadlessReporterResult constructor: (name) -> diff --git a/jasmine/jasmine.headless-reporter.js b/jasmine/jasmine.headless-reporter.js index e1a34b6..ca8ed50 100644 --- a/jasmine/jasmine.headless-reporter.js +++ b/jasmine/jasmine.headless-reporter.js @@ -2,7 +2,7 @@ var HeadlessReporterResult; var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; if (!(typeof jasmine !== "undefined" && jasmine !== null)) { - throw new Exception("jasmine not laoded!"); + throw new Error("jasmine not laoded!"); } HeadlessReporterResult = (function() { function HeadlessReporterResult(name) {