Sha256: b5972b18110b04f5e37e9a2dcf6e19216dbfe3dbfcfd7242784fd79c765783c3

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env rake
require "bundler/gem_tasks"
require 'rake/testtask'

Rake::TestTask.new do |t|
  t.libs = ["test"]
  t.pattern = "test/**/*_test.rb"
  t.ruby_opts = ['-w']
end

task :default => :test

pwd = File.expand_path('../', __FILE__)

# set an array ["4.2.0", "4.2.1", ... "4.2.9", "5.0.0", "5.0.1", ... "5.1.0", ... "5.1.6", "5.2.0"]
activerecord_versions =
  { "4.2" => (0..9).to_a,
    "5.0" => (0..6).to_a,
    "5.1" => (0..6).to_a,
    "5.2" => [0],
  }.map do |base_version, tiny_versions|
    tiny_versions.map { |tiny_version| "#{base_version}.#{tiny_version}" }
  end.flatten

namespace :test do
  activerecord_versions.each do |activerecord_version|
    desc "Run Tests with activerecord #{activerecord_version}"
    task "activerecord-#{activerecord_version}" do
      gemfile = "#{pwd}/gemfiles/test.gemfile"
      sh "VERSION=#{activerecord_version} BUNDLE_GEMFILE='#{gemfile}' bundle install --path #{pwd}/.bundle"
      sh "VERSION=#{activerecord_version} BUNDLE_GEMFILE='#{gemfile}' bundle exec rake -t test"
      sh "rm #{gemfile}.lock"
    end
  end

  desc "Run All Tests"
  task :all do
    activerecord_versions.each do |activerecord_version|
      Rake::Task["test:activerecord-#{activerecord_version}"].invoke
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_record_association_query_economizer-0.1.7 Rakefile
active_record_association_query_economizer-0.1.6 Rakefile