Skip to content

Commit

Permalink
If it is attempted to load RSpec 1 before RSpec 2 in an environment w…
Browse files Browse the repository at this point in the history
…hich has

RSpec 2 only, then RSpec 2 will complain that one is using deprecated RSpec 1.
  • Loading branch information
monde committed Jan 28, 2011
1 parent 8ecdafd commit 0dc6b2f
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions lib/hoe/test.rb
Expand Up @@ -97,28 +97,25 @@ def define_test_tasks
end

if File.directory? "spec" then
found = true
begin
if defined?(RSpec) then
require 'rspec/core/rake_task' # rspec 2

desc "Run all specifications"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = self.rspec_options
t.rspec_opts << "-I#{self.rspec_dirs.join(":")}" unless
rspec_dirs.empty?
end
elsif defined?(Spec) then
require 'spec/rake/spectask' # rspec 1

desc "Run all specifications"
Spec::Rake::SpecTask.new(:spec) do |t|
t.libs = self.rspec_dirs
t.spec_opts = self.rspec_options
end
rescue LoadError
begin
require 'rspec/core/rake_task' # rspec 2

desc "Run all specifications"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = self.rspec_options
t.rspec_opts << "-I#{self.rspec_dirs.join(":")}" unless
rspec_dirs.empty?
end
rescue LoadError
found = false
end
else
found = true
end

if found then
Expand Down

0 comments on commit 0dc6b2f

Please sign in to comment.