Skip to content

Commit

Permalink
Merge pull request ActsAsParanoid#278 from ActsAsParanoid/use-appraisal
Browse files Browse the repository at this point in the history
Use appraisal to manage test gemfiles
  • Loading branch information
mvz authored Apr 10, 2022
2 parents 25c77b6 + 91c0879 commit 4a7e2d6
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 47 deletions.
33 changes: 33 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

appraise "active_record_52" do
gem "activerecord", "~> 5.2.0", require: "active_record"
gem "activesupport", "~> 5.2.0", require: "active_support"
end

appraise "active_record_60" do
gem "activerecord", "~> 6.0.0", require: "active_record"
gem "activesupport", "~> 6.0.0", require: "active_support"

group :development do
gem "activerecord-jdbcsqlite3-adapter", "~> 60.0", platforms: [:jruby]
end
end

appraise "active_record_61" do
gem "activerecord", "~> 6.1.0", require: "active_record"
gem "activesupport", "~> 6.1.0", require: "active_support"

group :development do
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platforms: [:jruby]
end
end

appraise "active_record_70" do
gem "activerecord", "~> 7.0.0", require: "active_record"
gem "activesupport", "~> 7.0.0", require: "active_support"

group :development do
gem "activerecord-jdbcsqlite3-adapter", "~> 61.1", platforms: [:jruby]
end
end
14 changes: 13 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ To send pull requests or patches, please follow the instructions below.
**If you get stuck, please make a pull request anyway and we'll try to
help out.**

- Make sure `rake test` runs without reporting any failures.
- Make sure `bundle exec rake` runs without reporting any failures.
- Add tests for your feature. Otherwise, we can't see if it works or if we
break it later.
- Create a separate branch for your feature based off of latest master.
Expand All @@ -38,6 +38,18 @@ help out.**
- Keep an eye on the build results in GitHub Actions. If the build fails and it
seems due to your changes, please update your pull request with a fix.

### Testing your changes

You can run the test suite with the latest version of all dependencies by running the following:

- Run `bundle install` if you haven't done so already, or `bundle update` to update the dependencies
- Run `bundle exec rake` to run the tests

To run the tests suite for a particular version of ActiveRecord use
[appraisal](https://github.com/thoughtbot/appraisal). For example, to run the
specs with ActiveRecord 6.1, run `appraisal active_record_61 rake`. See appraisal's
documentation for details.

### The review process

- We will try to review your pull request as soon as possible but we can make no
Expand Down
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

source "https://rubygems.org"

gem "activerecord", require: "active_record"
gem "activesupport", require: "active_support"

# Development dependencies
group :development do
gem "activerecord-jdbcsqlite3-adapter", platforms: [:jruby]
Expand Down
22 changes: 1 addition & 21 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,6 @@ require "rake/testtask"
require "rdoc/task"
require "rubocop/rake_task"

namespace :test do
versions = Dir["gemfiles/*.gemfile"]
.map { |gemfile_path| gemfile_path.split(%r{/|\.})[1] }

versions.each do |version|
desc "Test acts_as_paranoid against #{version}"
task version do
if ENV["RUBYOPT"] =~ %r{bundler/setup}
raise "Do not run the test:#{version} task with bundle exec!"
end

sh "BUNDLE_GEMFILE='gemfiles/#{version}.gemfile' bundle install --quiet"
sh "BUNDLE_GEMFILE='gemfiles/#{version}.gemfile' bundle exec rake -t test"
end
end

desc "Run all tests for acts_as_paranoid"
task all: versions
end

Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.pattern = "test/test_*.rb"
Expand Down Expand Up @@ -55,4 +35,4 @@ end
task build: ["manifest:check"]

desc "Default: run tests and check manifest"
task default: ["test:all", "manifest:check"]
task default: ["test", "manifest:check"]
1 change: 1 addition & 0 deletions acts_as_paranoid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "activerecord", ">= 5.2", "< 7.1"
spec.add_runtime_dependency "activesupport", ">= 5.2", "< 7.1"

spec.add_development_dependency "appraisal", "~> 2.3"
spec.add_development_dependency "minitest", "~> 5.14"
spec.add_development_dependency "minitest-focus", "~> 1.3"
spec.add_development_dependency "pry", "~> 0.14.1"
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/active_record_52.gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", "~> 5.2.0", require: "active_record"
gem "activesupport", "~> 5.2.0", require: "active_support"

# Development dependencies
group :development do
gem "activerecord-jdbcsqlite3-adapter", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/active_record_60.gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", "~> 6.0.0", require: "active_record"
gem "activesupport", "~> 6.0.0", require: "active_support"

# Development dependencies
group :development do
gem "activerecord-jdbcsqlite3-adapter", "~> 60.0", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/active_record_61.gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", "~> 6.1.0", require: "active_record"
gem "activesupport", "~> 6.1.0", require: "active_support"

# Development dependencies
group :development do
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/active_record_70.gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", "~> 7.0.0", require: "active_record"
gem "activesupport", "~> 7.0.0", require: "active_support"

# Development dependencies
group :development do
gem "activerecord-jdbcsqlite3-adapter", "~> 61.1", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
Expand Down
18 changes: 0 additions & 18 deletions gemfiles/active_record_edge.gemfile

This file was deleted.

0 comments on commit 4a7e2d6

Please sign in to comment.