diff --git a/lib/jasmine/headless/task.rb b/lib/jasmine/headless/task.rb index a727378..113030e 100644 --- a/lib/jasmine/headless/task.rb +++ b/lib/jasmine/headless/task.rb @@ -42,7 +42,7 @@ module Jasmine private def create_rails_compliant_task - if Rails.version >= "3.1.0" + if Rails.respond_to?(:version) && 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.digest_class = Digest::JasmineTest diff --git a/spec/lib/jasmine/headless/task_spec.rb b/spec/lib/jasmine/headless/task_spec.rb index a6dc643..0f5d791 100644 --- a/spec/lib/jasmine/headless/task_spec.rb +++ b/spec/lib/jasmine/headless/task_spec.rb @@ -21,16 +21,32 @@ describe Jasmine::Headless::Task do end context 'with Rails' do - before do - module Rails - def self.version - return "0" + context 'without version' do + before do + module Rails + def self.version + return "0" + end end end + + it 'should be OK if rails is defined' do + Jasmine::Headless::Task.new('jasmine:headless') + end end - it 'should be OK if rails is defined' do - Jasmine::Headless::Task.new('jasmine:headless') + context 'with version' do + before do + module Rails + def self.version + return "0" + end + end + end + + it 'should be OK if rails is defined' do + Jasmine::Headless::Task.new('jasmine:headless') + end end end end