Skip to content

Commit da03a0b

Browse files
committed
appraisal gem to test under multiple active_record versions
1 parent 5f787b2 commit da03a0b

File tree

7 files changed

+57
-1
lines changed

7 files changed

+57
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55

66
# Exclude Gemfile.lock (best practice for gems)
77
Gemfile.lock
8+
9+
# Exclude appraisal .locks. per appraisal readme advice
10+
/gemfiles/*.lock

Appraisals

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# https://github.com/thoughtbot/appraisal
2+
3+
appraise "rails-52" do
4+
gem 'activerecord', '~> 5.2.0'
5+
end
6+
7+
appraise "rails-60" do
8+
gem 'activerecord', '~> 6.0.0'
9+
end

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ gemspec
55
gem 'jruby-openssl', :platform => :jruby
66

77
group :test do
8-
gem 'activerecord', '~> 5.2.0'
98
gem 'activerecord-jdbcsqlite3-adapter', :platform => [:jruby]
109
gem 'libxml-ruby', :platform => [:ruby, :mswin]
1110
gem 'rake'

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ Tests are with Test::Unit, in a somewhat archaic/legacy style. Test setup especi
9494

9595
There are also convenience tasks to run subsets of tests.
9696

97+
We use [appraisal](https://github.com/thoughtbot/appraisal) to test ActiveRecord-related functionality under multiple versions of ActiveRecord. While the above commands will test with latest ActiveRecord (allowed in our .gemspec development dependency), you can test under a particular version defined in the [Appraisals](./Appraisals) file like so:
98+
99+
$ bundle exec appraisal rails-52 rake test
100+
$ bundle exec appraisal rails-60 rake test
101+
97102
License
98103
-------
99104

gemfiles/rails_52.gemfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This file was generated by Appraisal
2+
3+
source "http://rubygems.org"
4+
5+
gem "jruby-openssl", platform: :jruby
6+
gem "activerecord", "~> 5.2.0"
7+
8+
group :test do
9+
gem "activerecord-jdbcsqlite3-adapter", platform: [:jruby]
10+
gem "libxml-ruby", platform: [:ruby, :mswin]
11+
gem "rake"
12+
gem "yard"
13+
gem "redcarpet", platform: :ruby
14+
gem "kramdown", platform: :jruby
15+
gem "test-unit"
16+
gem "sqlite3", ">= 1.4.0", "< 2.0", platform: [:ruby, :mswin]
17+
end
18+
19+
gemspec path: "../"

gemfiles/rails_60.gemfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This file was generated by Appraisal
2+
3+
source "http://rubygems.org"
4+
5+
gem "jruby-openssl", platform: :jruby
6+
gem "activerecord", "~> 6.0.0"
7+
8+
group :test do
9+
gem "activerecord-jdbcsqlite3-adapter", platform: [:jruby]
10+
gem "libxml-ruby", platform: [:ruby, :mswin]
11+
gem "rake"
12+
gem "yard"
13+
gem "redcarpet", platform: :ruby
14+
gem "kramdown", platform: :jruby
15+
gem "test-unit"
16+
gem "sqlite3", ">= 1.4.0", "< 2.0", platform: [:ruby, :mswin]
17+
end
18+
19+
gemspec path: "../"

ruby-oai.gemspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ Gem::Specification.new do |s|
1515
s.add_dependency('faraday')
1616
s.add_dependency('faraday_middleware')
1717

18+
s.add_development_dependency "activerecord", ">= 5.2.0", "< 6.1"
1819
s.add_development_dependency "appraisal"
1920

21+
2022
s.files = %w(README.md Rakefile) +
2123
Dir.glob("{bin,test,lib}/**/*") +
2224
Dir.glob("examples/**/*.rb")

0 commit comments

Comments
 (0)