Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Upgrade to RSpec 2

  • Loading branch information...
commit 342144f6de9a99b5c9439fe60ceb2e0aabf927dd 1 parent 4da8ee9
@mocoso authored
Showing with 21 additions and 15 deletions.
  1. +13 −12 Rakefile
  2. +8 −3 Support/spec/spec_helper.rb
View
25 Rakefile
@@ -1,12 +1,12 @@
# RSpec support
begin
- require 'spec'
+ require 'rspec'
rescue LoadError
require 'rubygems'
- require 'spec'
+ require 'rspec'
end
begin
- require 'spec/rake/spectask'
+ require "rspec/core/rake_task"
rescue LoadError
puts <<-EOS
To use rspec for testing you must install rspec gem:
@@ -15,22 +15,23 @@ rescue LoadError
exit(0)
end
-spec_common = Proc.new do |t|
- t.spec_files = FileList['Support/spec/**/*/*_spec.rb']
+spec_common = Proc.new do |spec|
+ spec.pattern = 'Support/spec/**/*/*_spec.rb'
+ spec.rspec_opts = ['--backtrace']
end
task :default => :spec
desc "Run all specs in spec directory"
-Spec::Rake::SpecTask.new(:spec) do |t|
- spec_common.call(t)
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec_common.call(spec)
end
namespace :spec do
- desc "Run all specs in spec directory with RCov (excluding plugin specs)"
- Spec::Rake::SpecTask.new(:rcov) do |t|
- spec_common.call(t)
- t.rcov = true
- t.rcov_opts = ['-x', 'Support/spec/', '-T']
+ desc "Run all specs in spec directory with RCov"
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
+ spec_common.call(spec)
+ spec.rcov = true
+ spec.rcov_opts = ['-x', 'Support/spec/', '-T']
end
end
View
11 Support/spec/spec_helper.rb
@@ -1,5 +1,9 @@
-require 'rubygems'
-require 'spec'
+begin
+ require 'rspec'
+rescue LoadError
+ require 'rubygems'
+ require 'rspec'
+end
require 'ruby-debug'
require 'yaml'
require File.dirname(__FILE__) + '/../lib/rbeautify.rb'
@@ -91,10 +95,11 @@ def be_block_end_like(block_start, offset, match, after_match)
end
end
-Spec::Runner.configure do |config|
+RSpec.configure do |config|
config.include(RBeautifyMatchers)
end
+
def run_fixtures_for_language(language)
fixtures = YAML.load_file(File.dirname(__FILE__) + "/fixtures/#{language}.yml")
Please sign in to comment.
Something went wrong with that request. Please try again.