Upgrade RSpec 1.x to RSpec 2.10-x

This commit is contained in:
Simone Carletti 2012-06-14 11:18:35 +02:00
parent 53fae92986
commit 16363939b9
7 changed files with 38 additions and 46 deletions

2
.rspec Normal file
View File

@ -0,0 +1,2 @@
--colour
--format documentation

View File

@ -21,7 +21,7 @@ end
group :test, :development do
gem 'rake', '>= 0.9.0'
gem 'rspec', '~> 1.2.9'
gem 'rspec', '~> 2.10.0'
gem 'rcov', '>= 0.9.9', :platform => :mri_18
end

View File

@ -5,9 +5,9 @@ $LOAD_PATH.uniq!
require 'rubygems'
require 'rake'
gem 'rspec', '~> 1.2.9'
gem 'rspec', '~> 2.10.0'
begin
require 'spec/rake/spectask'
require 'rspec/core/rake_task'
rescue LoadError
STDERR.puts "Please install rspec:"
STDERR.puts "sudo gem install rspec"

View File

@ -1,2 +0,0 @@
--colour
--format specdoc

View File

@ -3,3 +3,6 @@ lib_dir = File.expand_path("../lib", spec_dir)
$LOAD_PATH.unshift(lib_dir)
$LOAD_PATH.uniq!
RSpec.configure do |config|
end

View File

@ -39,7 +39,7 @@ namespace :gem do
s.add_development_dependency('sinatra', '>= 1.2.0')
s.add_development_dependency('rake', '>= 0.9.0')
s.add_development_dependency('rspec', '~> 1.2.9')
s.add_development_dependency('rspec', '~> 2.10.0')
s.add_development_dependency('rcov', '>= 0.9.9')
s.require_path = 'lib'

View File

@ -1,16 +1,31 @@
require 'spec/rake/verify_rcov'
require 'rake/clean'
CLOBBER.include('coverage', 'specdoc')
namespace :spec do
Spec::Rake::SpecTask.new(:rcov) do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc']
RSpec::Core::RakeTask.new(:all) do |t|
end
RSpec::Core::RakeTask.new(:fast) do |t|
t.pattern = FileList['spec/**/*_spec.rb'].exclude(
'spec/**/*_slow_spec.rb'
)
end
desc 'Generate HTML Specdocs for all specs.'
RSpec::Core::RakeTask.new(:specdoc) do |t|
specdoc_path = File.expand_path('../../specdoc', __FILE__)
Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
t.rspec_opts = %W( --format html --out #{File.join(specdoc_path, 'index.html')} )
t.fail_on_error = false
end
RSpec::Core::RakeTask.new(:rcov) do |t|
if RCOV_ENABLED
if `which rcov`.strip == ""
STDERR.puts(
"Please install rcov and ensure that its binary is in the PATH:"
"Please install rcov and ensure that its binary is in the PATH:"
)
STDERR.puts("sudo gem install rcov")
exit(1)
@ -19,30 +34,16 @@ namespace :spec do
else
t.rcov = false
end
t.rcov_opts = [
'--exclude', 'lib\\/google\\/api_client\\/environment.rb',
'--exclude', 'lib\\/compat',
'--exclude', 'spec',
'--exclude', '\\.rvm\\/gems',
'--exclude', '1\\.8\\/gems',
'--exclude', '1\\.9\\/gems',
'--exclude', '\\.rvm',
'--exclude', '\\/Library\\/Ruby',
]
end
Spec::Rake::SpecTask.new(:all) do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc']
t.rcov = false
end
Spec::Rake::SpecTask.new(:fast) do |t|
t.spec_files = FileList['spec/**/*_spec.rb'].exclude(
'spec/**/*_slow_spec.rb'
t.rcov_opts = %w(
--exclude lib/google/api_client/environment.rb,
lib/compat,
spec,
.rvm/gems,
1.8/gems,
1.9/gems,
.rvm,
/Library/Ruby
)
t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc']
t.rcov = false
end
if RCOV_ENABLED
@ -54,18 +55,6 @@ namespace :spec do
task :verify => :rcov
end
desc 'Generate HTML Specdocs for all specs'
Spec::Rake::SpecTask.new(:specdoc) do |t|
specdoc_path = File.expand_path(
File.join(File.dirname(__FILE__), '../specdoc/'))
Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
output_file = File.join(specdoc_path, 'index.html')
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = ['--format', "\"html:#{output_file}\"", '--diff']
t.fail_on_error = false
end
namespace :rcov do
desc 'Browse the code coverage report.'
task :browse => 'spec:rcov' do