Skip to content

Commit 305bad0

Browse files
committed
Fix tests
1 parent 00e09fd commit 305bad0

File tree

4 files changed

+29
-20
lines changed

4 files changed

+29
-20
lines changed

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/environments/test.rb

+8-6
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
# preloads Rails for running tests, you may have to set it to true.
1313
config.eager_load = false
1414

15-
# Configure public file server for tests with Cache-Control for performance.
16-
config.public_file_server.enabled = true
17-
config.public_file_server.headers = {
18-
'Cache-Control' => 'public, max-age=3600'
19-
}
15+
if Rails.version >= '5.0.0'
16+
# Configure public file server for tests with Cache-Control for performance.
17+
config.public_file_server.enabled = true
18+
config.public_file_server.headers = {
19+
'Cache-Control' => 'public, max-age=3600'
20+
}
21+
end
2022

2123
# Show full error reports and disable caching.
2224
config.consider_all_requests_local = true
@@ -27,7 +29,7 @@
2729

2830
# Disable request forgery protection in test environment.
2931
config.action_controller.allow_forgery_protection = false
30-
config.action_mailer.perform_caching = false
32+
config.action_mailer.perform_caching = false if Rails.version >= '5.0.0'
3133

3234
# Tell Action Mailer not to deliver emails to the real world.
3335
# The :test delivery method accumulates sent emails in the

spec/dummy/config/initializers/new_framework_defaults.rb

+17-13
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,25 @@
44
#
55
# Read the Rails 5.0 release notes for more info on each option.
66

7-
# Enable per-form CSRF tokens. Previous versions had false.
8-
Rails.application.config.action_controller.per_form_csrf_tokens = true
7+
if Rails.version > '5.0'
8+
# Enable per-form CSRF tokens. Previous versions had false.
9+
Rails.application.config.action_controller.per_form_csrf_tokens = true
910

10-
# Enable origin-checking CSRF mitigation. Previous versions had false.
11-
Rails.application.config.action_controller.forgery_protection_origin_check = true
11+
# Enable origin-checking CSRF mitigation. Previous versions had false.
12+
Rails.application.config.action_controller.forgery_protection_origin_check = true
1213

13-
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
14-
# Previous versions had false.
15-
ActiveSupport.to_time_preserves_timezone = true
14+
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
15+
# Previous versions had false.
16+
ActiveSupport.to_time_preserves_timezone = true
1617

17-
# Require `belongs_to` associations by default. Previous versions had false.
18-
Rails.application.config.active_record.belongs_to_required_by_default = true
18+
# Require `belongs_to` associations by default. Previous versions had false.
19+
Rails.application.config.active_record.belongs_to_required_by_default = true
1920

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

23-
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
24-
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
26+
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
27+
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
28+
end
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)