Permalink
Browse files

Make Rakefile compatible with rails2 & rails3

  • Loading branch information...
1 parent b88bd5b commit b77e11ad5b06bc3c4558aaa63348b070024ed92c @mjonuschat mjonuschat committed with mjonuschat Apr 15, 2010
Showing with 27 additions and 3 deletions.
  1. +25 −2 Rakefile
  2. +2 −1 spec/spec_helper.rb
View
@@ -1,13 +1,17 @@
# coding: utf-8
+require 'rubygems'
require 'rake'
require 'rake/rdoctask'
begin
+ gem 'rspec', '>= 1.2.6'
+ gem 'rspec-rails', '>= 1.2.6'
+ require 'spec'
require 'spec/rake/spectask'
rescue LoadError
begin
- gem 'rspec-rails', '>= 1.0.0'
- require 'spec/rake/spectask'
+ require 'rspec/core/rake_task.rb'
+ require 'rspec/core/version'
rescue LoadError
puts "[formtastic:] RSpec - or one of it's dependencies - is not available. Install it with: sudo gem install rspec-rails"
end
@@ -99,3 +103,22 @@ if defined?(Spec)
t.rcov_opts = ['--exclude', 'spec,Library']
end
end
+
+if defined?(Rspec)
+ desc 'Test the formtastic plugin.'
+ Rspec::Core::RakeTask.new('spec') do |t|
+ t.pattern = FileList['spec/**/*_spec.rb']
+ end
+
+ desc 'Test the formtastic plugin with specdoc formatting and colors'
+ Rspec::Core::RakeTask.new('specdoc') do |t|
+ t.pattern = FileList['spec/**/*_spec.rb']
+ end
+
+ desc "Run all examples with RCov"
+ Rspec::Core::RakeTask.new('examples_with_rcov') do |t|
+ t.pattern = FileList['spec/**/*_spec.rb']
+ t.rcov = true
+ t.rcov_opts = ['--exclude', 'spec,Library']
+ end
+end
View
@@ -28,7 +28,8 @@
config.include(CustomMacros)
end
rescue
- Rspec.configure do |config|
+ require 'rspec/core'
+ Rspec::Core.configure do |config|
config.include RspecTagMatchers
config.include CustomMacros
config.mock_with :rspec

0 comments on commit b77e11a

Please sign in to comment.