1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00
activerecord-hackery--ransack/Rakefile
jonatack b2821db8e5 Try to improve Rails 3.x tests working with Ruby 2.2
Not sure it’s worth it but giving it a shot, at least for Rails 3.2.
2015-01-08 00:17:33 +01:00

47 lines
1.1 KiB
Ruby

require 'bundler'
require 'rspec/core/rake_task'
require 'active_record'
Bundler::GemHelper.install_tasks
RSpec::Core::RakeTask.new(:spec) do |rspec|
ENV['SPEC'] = 'spec/ransack/**/*_spec.rb'
if ActiveRecord::VERSION::MAJOR >= 4 || RUBY_VERSION < '2.2'
# Raises `invalid option: --backtrace` with Rails 3.x on Ruby 2.2
rspec.rspec_opts = ['--backtrace']
end
end
RSpec::Core::RakeTask.new(:mongoid) do |rspec|
ENV['SPEC'] = 'spec/mongoid/**/*_spec.rb'
rspec.rspec_opts = ['--backtrace']
end
task :default do
if ENV['DB'] =~ /mongodb/
Rake::Task["mongoid"].invoke
else
Rake::Task["spec"].invoke
end
end
desc "Open an irb session with Ransack and the sample data used in specs"
task :console do
require 'irb'
require 'irb/completion'
require 'console'
ARGV.clear
IRB.start
end
desc "Open an irb session with Ransack, Mongoid and the sample data used in specs"
task :mongoid_console do
require 'irb'
require 'irb/completion'
require 'pry'
require 'mongoid'
require File.expand_path('../lib/ransack.rb', __FILE__)
require File.expand_path('../spec/mongoid/support/schema.rb', __FILE__)
ARGV.clear
Pry.start
end