Merge pull request #28 from zspencer/master
Fixed defect with using the Rake Task without having Rails installed
This commit is contained in:
commit
96e071aa37
@ -42,15 +42,18 @@ module Jasmine
|
||||
:jasmine_config => @jasmine_config
|
||||
)
|
||||
end
|
||||
create_rails_compliant_task if defined?(Rails)
|
||||
end
|
||||
private
|
||||
def create_rails_compliant_task
|
||||
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
|
||||
|
||||
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
|
||||
Rake::Task['assets:precompile'].invoke
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
30
spec/lib/jasmine/headless/task_spec.rb
Normal file
30
spec/lib/jasmine/headless/task_spec.rb
Normal file
@ -0,0 +1,30 @@
|
||||
require 'spec_helper'
|
||||
require 'fakefs/spec_helpers'
|
||||
require 'jasmine/headless/task'
|
||||
|
||||
module Jasmine
|
||||
module Headless
|
||||
class Task
|
||||
def desc(block)
|
||||
end
|
||||
def task(block)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
describe Jasmine::Headless::Task do
|
||||
it 'should not explode when Rails is undefined' do
|
||||
Object.send(:remove_const, :Rails) if defined?(Rails)
|
||||
Jasmine::Headless::Task.new('jasmine:headless') do |t|
|
||||
end
|
||||
end
|
||||
it 'should be OK if rails is defined' do
|
||||
module Rails
|
||||
def self.version
|
||||
return "0"
|
||||
end
|
||||
end
|
||||
Jasmine::Headless::Task.new('jasmine:headless') do |t|
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user