Skip to content

Commit 4635800

Browse files
committed
Rails 6 support
1 parent 13e5341 commit 4635800

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

.travis.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ env:
55
- "RAILS_VERSION=5.0.7.2"
66
- "RAILS_VERSION=5.1.7"
77
- "RAILS_VERSION=5.2.3"
8-
# - "RAILS_VERSION=6.0.0.beta1"
8+
- "RAILS_VERSION=6.0.0"
99
# - "RAILS_VERSION=master"
1010
rvm:
1111
- 2.3.8
@@ -19,5 +19,9 @@ matrix:
1919
exclude:
2020
- rvm: 2.6.4
2121
env: "RAILS_VERSION=4.2.11"
22+
- rvm: 2.3.8
23+
env: "RAILS_VERSION=6.0.0"
24+
- rvm: 2.4.7
25+
env: "RAILS_VERSION=6.0.0"
2226
before_install:
23-
- gem install bundler --version 1.17.3
27+
- gem install bundler --version 1.17.3

Gemfile

+9-5
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@ source 'https://rubygems.org'
22

33
gemspec
44

5-
platforms :ruby do
6-
gem 'sqlite3', '1.3.10'
7-
end
8-
95
platforms :jruby do
106
gem 'activerecord-jdbcsqlite3-adapter'
117
end
128

139
version = ENV['RAILS_VERSION'] || 'default'
1410

11+
platforms :ruby do
12+
if version.start_with?('4.2', '5.0')
13+
gem 'sqlite3', '~> 1.3.13'
14+
else
15+
gem 'sqlite3', '~> 1.4'
16+
end
17+
end
18+
1519
case version
1620
when 'master'
1721
gem 'railties', { git: 'https://github.com/rails/rails.git' }
1822
gem 'arel', { git: 'https://github.com/rails/arel.git' }
1923
when 'default'
20-
gem 'railties', '>= 5.0'
24+
gem 'railties', '>= 6.0'
2125
else
2226
gem 'railties', "~> #{version}"
2327
end

test/test_helper.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ class ActionDispatch::IntegrationTest
470470
fixtures :all
471471

472472
def assert_jsonapi_response(expected_status, msg = nil)
473-
assert_equal JSONAPI::MEDIA_TYPE, response.content_type
473+
media_type = Rails::VERSION::MAJOR >= 6 ? response.media_type : response.content_type
474+
assert_equal JSONAPI::MEDIA_TYPE, media_type
474475
if status != expected_status && status >= 400
475476
pp json_response rescue nil
476477
end

0 commit comments

Comments
 (0)