Skip to content

Commit 08b324d

Browse files
authored
Merge pull request #90 from code4lib/support_more_recent_rails_testing
Support testing on Rails 6.1 and 7.0
2 parents 614cc8c + 6dd32d8 commit 08b324d

File tree

7 files changed

+54
-17
lines changed

7 files changed

+54
-17
lines changed

Appraisals

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ end
77
appraise "rails-60" do
88
gem 'activerecord', '~> 6.0.0'
99
end
10+
11+
appraise "rails-61" do
12+
gem 'activerecord', '~> 6.1.0'
13+
end
14+
15+
appraise "rails-70" do
16+
gem 'activerecord', '~> 7.0.0'
17+
end

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ There are also convenience tasks to run subsets of tests.
9797
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:
9898

9999
$ bundle exec appraisal rails-52 rake test
100-
$ bundle exec appraisal rails-60 rake test
100+
$ bundle exec appraisal rails-70 rake test
101101

102102
If you run into trouble with appraisal's gemfiles getting out of date and bundler complaining,
103103
try:

gemfiles/rails_61.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.1.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_70.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", "~> 7.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: "../"

lib/oai/provider/model/activerecord_wrapper.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ def parse_to_local(time)
192192
time_obj = Time.parse(time.to_s)
193193
time_obj = yield(time_obj) if block_given?
194194
# Convert to same as DB - :local => :getlocal, :utc => :getutc
195-
tzconv = "get#{model.default_timezone.to_s}".to_sym
195+
196+
if ActiveRecord::VERSION::MAJOR >= 7
197+
tzconv = "get#{ActiveRecord.default_timezone.to_s}".to_sym
198+
else
199+
tzconv = "get#{model.default_timezone.to_s}".to_sym
200+
end
196201
time_obj.send(tzconv).strftime("%Y-%m-%d %H:%M:%S")
197202
end
198203

ruby-oai.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ 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"
18+
s.add_development_dependency "activerecord", ">= 5.2.0", "< 7.1"
1919
s.add_development_dependency "appraisal"
2020

2121

test/activerecord_provider/tc_ar_provider.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,4 @@ def setup
149149

150150
end
151151

152-
class ActiveRecordProviderTimezoneTest < ActiveRecordProviderTest
153152

154-
def setup
155-
require 'active_record'
156-
ActiveRecord::Base.default_timezone = :utc
157-
super
158-
end
159-
160-
def teardown
161-
require 'active_record'
162-
ActiveRecord::Base.default_timezone = :local
163-
super
164-
end
165-
166-
end

0 commit comments

Comments
 (0)