Skip to content

Test against multiple rails versions. #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,29 @@ env:
global:
- CC_TEST_REPORTER_ID=98c9b3070ea9ac0e8f7afb6570f181506c3a06372b1db5c7deb8e46089fdf132
- 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)
matrix:
- "RAILS_VERSION=5.0.7.1"
- "RAILS_VERSION=5.1.6.1"
- "RAILS_VERSION=5.2.2"
- "RAILS_VERSION=master"
rvm:
- 2.2.2
- 2.3.3
- 2.2.9
- 2.3.8
- 2.6.1
- ruby-head
matrix:
allow_failures:
- rvm: ruby-head
- env: "RAILS_VERSION=master"
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
after_script:
# Preferably you will run test-reporter on branch update events. But
# if you setup travis to build PR updates only, you don't need to run
# Preferably you will run test-reporter on branch update events. But
# if you setup travis to build PR updates only, you don't need to run
# the line below
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
# In the case where travis is setup to build PR updates only,
# In the case where travis is setup to build PR updates only,
# uncomment the line below
# - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
source 'https://rubygems.org'

rails_version = ENV['RAILS_VERSION'] || "default"
rails =
case rails_version
when 'master'
{ github: 'rails/rails' }
when 'default'
'>= 5.0'
else
"~> #{ENV['RAILS_VERSION']}"
end

gem 'rails', rails

gemspec
2 changes: 1 addition & 1 deletion jsonapi-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'jsonapi-parser', '~> 0.1.0'

spec.add_development_dependency 'rails', '~> 5.0'
spec.add_development_dependency 'sqlite3'
spec.add_development_dependency 'sqlite3', '~> 1.3.6'
spec.add_development_dependency 'rake', '~> 11.3'
spec.add_development_dependency 'rspec-rails', '~> 3.5'
spec.add_development_dependency 'with_model', '~> 2.0'
Expand Down
4 changes: 3 additions & 1 deletion spec/dummy/config/initializers/new_framework_defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
Rails.application.config.active_record.belongs_to_required_by_default = true

# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = false
if Rails.version < '5.2'
ActiveSupport.halt_callback_chains_on_return_false = false
end

# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
3 changes: 3 additions & 0 deletions spec/dummy/config/initializers/sqlite3_fix.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if Rails.version >= '5.1.0' && Rails.application.config.active_record.sqlite3.present?
Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
end