1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Made 'rake spec' work with Ruby 1.9.2/RSpec 2

This commit is contained in:
Mike Dvorkin 2010-10-31 16:10:08 -07:00
parent 5f78c06a05
commit 816b5a6513
3 changed files with 30 additions and 14 deletions

View file

@ -21,9 +21,22 @@ rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end end
if RUBY_VERSION.to_f >= 1.9
require "rspec/core/rake_task" # RSpec 2.0
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.rspec_opts = ['--color']
end
RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.rcov = true
spec.rcov_opts = %q[--exclude "spec"]
end
else
require 'spec/rake/spectask' require 'spec/rake/spectask'
Spec::Rake::SpecTask.new(:spec) do |spec| Spec::Rake::SpecTask.new(:spec) do |spec|
spec.libs << 'lib' << 'spec' spec.libs << 'lib' << 'spec'
spec.spec_opts = ['--color']
spec.spec_files = FileList['spec/**/*_spec.rb'] spec.spec_files = FileList['spec/**/*_spec.rb']
end end
@ -32,6 +45,7 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
spec.pattern = 'spec/**/*_spec.rb' spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true spec.rcov = true
end end
end
task :spec => :check_dependencies task :spec => :check_dependencies

View file

@ -1 +0,0 @@
--color

View file

@ -1,12 +1,15 @@
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'ap' require 'ap'
if RUBY_VERSION.to_f < 1.9
require 'spec' require 'spec'
require 'spec/autorun' require 'spec/autorun'
require 'rubygems' require 'rubygems'
Spec::Runner.configure do |config| Spec::Runner.configure do |config|
end end
end
def stub_dotfile! def stub_dotfile!
dotfile = File.join(ENV["HOME"], ".aprc") dotfile = File.join(ENV["HOME"], ".aprc")