Skip to content

Commit c99bdec

Browse files
authored
Merge pull request jsonapi-rb#46 from jsonapi-rb/test-rails-versions
Test against multiple rails versions.
2 parents a084ca8 + d8c80cf commit c99bdec

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

.travis.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,29 @@ env:
66
global:
77
- CC_TEST_REPORTER_ID=98c9b3070ea9ac0e8f7afb6570f181506c3a06372b1db5c7deb8e46089fdf132
88
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
9+
matrix:
10+
- "RAILS_VERSION=5.0.7.1"
11+
- "RAILS_VERSION=5.1.6.1"
12+
- "RAILS_VERSION=5.2.2"
13+
- "RAILS_VERSION=master"
914
rvm:
10-
- 2.2.2
11-
- 2.3.3
15+
- 2.2.9
16+
- 2.3.8
17+
- 2.6.1
1218
- ruby-head
1319
matrix:
1420
allow_failures:
1521
- rvm: ruby-head
22+
- env: "RAILS_VERSION=master"
1623
before_script:
1724
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
1825
- chmod +x ./cc-test-reporter
1926
- ./cc-test-reporter before-build
2027
after_script:
21-
# Preferably you will run test-reporter on branch update events. But
22-
# if you setup travis to build PR updates only, you don't need to run
28+
# Preferably you will run test-reporter on branch update events. But
29+
# if you setup travis to build PR updates only, you don't need to run
2330
# the line below
2431
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
25-
# In the case where travis is setup to build PR updates only,
32+
# In the case where travis is setup to build PR updates only,
2633
# uncomment the line below
2734
# - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT

Gemfile

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
source 'https://rubygems.org'
22

3+
rails_version = ENV['RAILS_VERSION'] || "default"
4+
rails =
5+
case rails_version
6+
when 'master'
7+
{ github: 'rails/rails' }
8+
when 'default'
9+
'>= 5.0'
10+
else
11+
"~> #{ENV['RAILS_VERSION']}"
12+
end
13+
14+
gem 'rails', rails
15+
316
gemspec

jsonapi-rails.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
1818
spec.add_dependency 'jsonapi-parser', '~> 0.1.0'
1919

2020
spec.add_development_dependency 'rails', '~> 5.0'
21-
spec.add_development_dependency 'sqlite3'
21+
spec.add_development_dependency 'sqlite3', '~> 1.3.6'
2222
spec.add_development_dependency 'rake', '~> 11.3'
2323
spec.add_development_dependency 'rspec-rails', '~> 3.5'
2424
spec.add_development_dependency 'with_model', '~> 2.0'

spec/dummy/config/initializers/new_framework_defaults.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
Rails.application.config.active_record.belongs_to_required_by_default = true
1919

2020
# Do not halt callback chains when a callback returns false. Previous versions had true.
21-
ActiveSupport.halt_callback_chains_on_return_false = false
21+
if Rails.version < '5.2'
22+
ActiveSupport.halt_callback_chains_on_return_false = false
23+
end
2224

2325
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
2426
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if Rails.version >= '5.1.0' && Rails.application.config.active_record.sqlite3.present?
2+
Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
3+
end

0 commit comments

Comments
 (0)