2011-03-30 20:31:39 -04:00
|
|
|
require 'bundler'
|
|
|
|
require 'rspec/core/rake_task'
|
2015-01-07 18:17:33 -05:00
|
|
|
require 'active_record'
|
2011-03-30 20:31:39 -04:00
|
|
|
|
|
|
|
Bundler::GemHelper.install_tasks
|
|
|
|
|
|
|
|
RSpec::Core::RakeTask.new(:spec) do |rspec|
|
2014-08-01 05:04:54 -04:00
|
|
|
ENV['SPEC'] = 'spec/ransack/**/*_spec.rb'
|
2015-01-07 18:17:33 -05:00
|
|
|
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
|
2014-08-01 05:04:54 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
RSpec::Core::RakeTask.new(:mongoid) do |rspec|
|
|
|
|
ENV['SPEC'] = 'spec/mongoid/**/*_spec.rb'
|
2011-03-30 20:31:39 -04:00
|
|
|
rspec.rspec_opts = ['--backtrace']
|
|
|
|
end
|
|
|
|
|
2014-08-04 01:48:13 -04:00
|
|
|
task :default do
|
|
|
|
if ENV['DB'] =~ /mongodb/
|
|
|
|
Rake::Task["mongoid"].invoke
|
|
|
|
else
|
|
|
|
Rake::Task["spec"].invoke
|
|
|
|
end
|
|
|
|
end
|
2011-03-30 20:31:39 -04:00
|
|
|
|
|
|
|
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
|
2014-11-02 14:14:12 -05:00
|
|
|
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
|