Permalink
Browse files

Merge pull request #4 from uwabami/master

update for RSpec >= 2
  • Loading branch information...
2 parents eaf3460 + 296596f commit c57a96a34aefa210a84f9fa1f3d61945130be4bd @cho45 committed Feb 2, 2012
Showing with 33 additions and 8 deletions.
  1. +31 −6 Rakefile
  2. +1 −1 spec/channel_manager_spec.rb
  3. +1 −1 spec/net-irc_spec.rb
View
37 Rakefile
@@ -7,7 +7,21 @@ require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/contrib/sshpublisher'
require 'fileutils'
-require 'spec/rake/spectask'
+# Adaptable to both RSpec 1 and 2
+rspec_version = nil
+begin
+ # for RSpec 2
+ require 'rspec/core/rake_task'
+ rspec_version = 2
+rescue LoadError
+ begin
+ # for RSpec 1
+ require 'spec/rake/spectask'
+ rspec_version = 1
+ rescue LoadError
+ puts "RSpec is not available."
+ end
+end
include FileUtils
@@ -35,11 +49,22 @@ RDOC_OPTS = [
task :default => [:spec]
task :package => [:clean]
-
-Spec::Rake::SpecTask.new do |t|
- t.spec_opts = ['--options', "spec/spec.opts"]
- t.spec_files = FileList['spec/*_spec.rb']
- #t.rcov = true
+if rspec_version then
+ case rspec_version
+ when 1
+ Spec::Rake::SpecTask.new do |t|
+ t.spec_opts = ['--options', "spec/spec.opts"]
+ t.spec_files = FileList['spec/*_spec.rb']
+ # t.rcov = true
+ end
+ when 2
+ RSpec::Core::RakeTask.new do |t|
+ t.rspec_opts = ['--options', "spec/spec.opts"]
+ # t.rcov = true
+ end
+ else
+ raise "RSpec is not available."
+ end
end
spec = Gem::Specification.new do |s|
View
2 spec/channel_manager_spec.rb
@@ -4,7 +4,7 @@
$LOAD_PATH << "../lib"
require "rubygems"
-require "spec"
+require "rspec"
require "thread"
require "net/irc"
require "net/irc/client/channel_manager"
View
2 spec/net-irc_spec.rb
@@ -6,7 +6,7 @@
$LOAD_PATH << "../lib"
require "rubygems"
-require "spec"
+require "rspec"
require "net/irc"
include Net::IRC
include Constants

0 comments on commit c57a96a

Please sign in to comment.