Skip to content
Browse files

Support RSpec 2

  • Loading branch information...
1 parent 29d7110 commit 5aa339c7097a37cf770c9a9567644cf701b24ecc @leshill committed Jun 29, 2010
View
0 spec/spec.opts → .rspec
File renamed without changes.
View
2 Gemfile
@@ -2,4 +2,4 @@ source :rubygems
gem "jeweler", ">= 1.4.0"
gem "resque", ">= 1.6.0"
-gem "rspec", ">= 1.3.0"
+gem "rspec", ">= 2.0.0.beta.14"
View
4 README.md
@@ -4,7 +4,9 @@ ResqueSpec
A simple RSpec and Cucumber matcher for Resque.enqueue and Resque.enqueue_at (from `ResqueScheduler`), loosely based on
[http://github.com/justinweiss/resque_unit](resque_unit).
-This should work with Resque v1.6.0 and up and RSpec v1.3.0 and up.
+This should work with `Resque v1.6.0` and up and `RSpec v2.0.0.beta.12` and up.
+
+If you are using `RSpec ~> 1.3.0`, you should use version `~> 0.2.0`.
Install
-------
View
12 Rakefile
@@ -11,22 +11,20 @@ begin
gem.homepage = "http://github.com/leshill/resque_spec"
gem.authors = ["Les Hill"]
gem.add_dependency "resque", ">= 1.6.0"
- gem.add_dependency "rspec", ">= 1.3.0"
+ gem.add_dependency "rspec", ">= 2.0.0.beta.12"
gem.add_development_dependency "jeweler", ">= 1.4.0"
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
-require 'spec/rake/spectask'
-Spec::Rake::SpecTask.new(:spec) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.spec_files = FileList['spec/**/*_spec.rb']
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = 'spec/**/*_spec.rb'
end
-Spec::Rake::SpecTask.new(:rcov) do |spec|
- spec.libs << 'lib' << 'spec'
+RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
end
View
4 lib/resque_spec/resque_scheduler_spec.rb
@@ -24,7 +24,7 @@ def enqueue_at(time, klass, *args)
Resque.extend(ResqueSpec::ResqueScheduler)
-Spec::Matchers.define :have_scheduled do |*expected_args|
+RSpec::Matchers.define :have_scheduled do |*expected_args|
match do |actual|
ResqueSpec.scheduled_anytime?(actual, *expected_args)
end
@@ -42,7 +42,7 @@ def enqueue_at(time, klass, *args)
end
end
-Spec::Matchers.define :have_scheduled_at do |*expected_args|
+RSpec::Matchers.define :have_scheduled_at do |*expected_args|
match do |actual|
ResqueSpec.scheduled?(actual, *expected_args)
end
View
3 lib/resque_spec/resque_spec.rb
@@ -1,3 +1,4 @@
+require 'rspec'
require 'resque'
module ResqueSpec
@@ -33,7 +34,7 @@ def enqueue(klass, *args)
Resque.extend(ResqueSpec::Resque)
-Spec::Matchers.define :have_queued do |*expected_args|
+RSpec::Matchers.define :have_queued do |*expected_args|
match do |actual|
ResqueSpec.in_queue?(actual, *expected_args)
end
View
6 spec/resque_scheduler_spec_spec.rb
@@ -35,19 +35,19 @@
it "raises if there is no schedule queue defined for a class" do
expect do
ResqueSpec.schedule_for(Address)
- end.should raise_exception(::Resque::NoQueueError)
+ end.should raise_error(::Resque::NoQueueError)
end
it "recognizes a queue defined as a class instance variable" do
expect do
ResqueSpec.schedule_for(Person)
- end.should_not raise_exception(::Resque::NoQueueError)
+ end.should_not raise_error(::Resque::NoQueueError)
end
it "recognizes a queue defined as a class method" do
expect do
ResqueSpec.schedule_for(Account)
- end.should_not raise_exception(::Resque::NoQueueError)
+ end.should_not raise_error(::Resque::NoQueueError)
end
it "has an empty array if nothing queued for a class" do
View
6 spec/resque_spec_spec.rb
@@ -12,19 +12,19 @@
it "raises if there is no queue defined for a class" do
expect do
ResqueSpec.queue_for(Address)
- end.should raise_exception(::Resque::NoQueueError)
+ end.should raise_error(::Resque::NoQueueError)
end
it "recognizes a queue defined as a class instance variable" do
expect do
ResqueSpec.queue_for(Person)
- end.should_not raise_exception(::Resque::NoQueueError)
+ end.should_not raise_error(::Resque::NoQueueError)
end
it "recognizes a queue defined as a class method" do
expect do
ResqueSpec.queue_for(Account)
- end.should_not raise_exception(::Resque::NoQueueError)
+ end.should_not raise_error(::Resque::NoQueueError)
end
it "has an empty array if nothing queued for a class" do
View
6 spec/spec_helper.rb
@@ -1,10 +1,10 @@
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+require 'rspec'
+require 'rspec/autorun'
require 'resque_spec'
-require 'spec'
-require 'spec/autorun'
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
-Spec::Runner.configure do |config|
+RSpec.configure do |config|
end

0 comments on commit 5aa339c

Please sign in to comment.
Something went wrong with that request. Please try again.