Move rspec rake stuff into loaderror begin-rescue so that we can deploy with --without test

This commit is contained in:
Raphael Sofaer 2011-04-06 14:44:04 -07:00
parent 847a66735a
commit 8af6fab0a4

View file

@ -5,30 +5,6 @@
begin
require 'rspec/core'
require 'rspec/core/rake_task'
rescue MissingSourceFile
module RSpec
module Core
class RakeTask
def initialize(name)
task name do
# if rspec-rails is a configured gem, this will output helpful material and exit ...
require File.expand_path(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
# ... otherwise, do this:
raise <<-MSG
#{"*" * 80}
* You are trying to run an rspec rake task defined in
* #{__FILE__},
* but rspec can not be found in vendor/gems, vendor/plugins or system gems.
#{"*" * 80}
MSG
end
end
end
end
end
end
spec_prereq = Rails.root.join('config', 'database.yml').exist? ? "db:test:prepare" : :noop
task :noop do
@ -73,4 +49,27 @@ namespace :"spec --color" do
end
end
rescue MissingSourceFile
module RSpec
module Core
class RakeTask
def initialize(name)
task name do
# if rspec-rails is a configured gem, this will output helpful material and exit ...
require File.expand_path(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
# ... otherwise, do this:
raise <<-MSG
#{"*" * 80}
* You are trying to run an rspec rake task defined in
* #{__FILE__},
* but rspec can not be found in vendor/gems, vendor/plugins or system gems.
#{"*" * 80}
MSG
end
end
end
end
end
end