Skip to content
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
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
- "RAILS_VERSION=5.1.7"
- "RAILS_VERSION=5.2.3"
- "RAILS_VERSION=6.0.0"
- "RAILS_VERSION=6.1.0"
rvm:
- 2.3.8
- 2.4.7
Expand All @@ -22,5 +23,9 @@ matrix:
env: "RAILS_VERSION=6.0.0"
- rvm: 2.4.7
env: "RAILS_VERSION=6.0.0"
- rvm: 2.3.8
env: "RAILS_VERSION=6.1.0"
- rvm: 2.4.7
env: "RAILS_VERSION=6.1.0"
before_install:
- gem install bundler --version 1.17.3
4 changes: 2 additions & 2 deletions lib/jsonapi/resource_controller_metal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ class ResourceControllerMetal < ActionController::Metal
ActionController::Rendering,
ActionController::Renderers::All,
ActionController::StrongParameters,
ActionController::ForceSSL,
Gem::Requirement.new('< 6.1').satisfied_by?(ActionPack.gem_version) ? ActionController::ForceSSL : nil,
ActionController::Instrumentation,
JSONAPI::ActsAsResourceController
].freeze
].compact.freeze

MODULES.each do |mod|
include mod
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ class Post < ActiveRecord::Base
belongs_to :writer, class_name: 'Person', foreign_key: 'author_id'
has_many :comments
has_and_belongs_to_many :tags, join_table: :posts_tags
has_many :special_post_tags, source: :tag
has_many :special_post_tags
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this failing on 6.1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. because of rails/rails@b30a23f

has_many :special_tags, through: :special_post_tags, source: :tag
belongs_to :section
has_one :parent_post, class_name: 'Post', foreign_key: 'parent_post_id'
Expand Down
8 changes: 4 additions & 4 deletions test/integration/requests/request_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ def test_caching_included_singleton
}

$test_user = Person.find(1)
assert_equal 2, JSONAPI.configuration.resource_cache.instance_variable_get(:@key_access).length
assert_equal 2, JSONAPI.configuration.resource_cache.instance_variable_get(:@data).length

get "/api/v9/people/#{$test_user.id}?include=preferences"
assert_jsonapi_response 200
Expand Down Expand Up @@ -1477,7 +1477,7 @@ def test_caching_included_singleton
]
}

assert_equal 4, JSONAPI.configuration.resource_cache.instance_variable_get(:@key_access).length
assert_equal 4, JSONAPI.configuration.resource_cache.instance_variable_get(:@data).length

ensure
JSONAPI.configuration = original_config
Expand Down Expand Up @@ -1522,7 +1522,7 @@ def test_caching_singleton_primary
}
}

assert_equal 1, JSONAPI.configuration.resource_cache.instance_variable_get(:@key_access).length
assert_equal 1, JSONAPI.configuration.resource_cache.instance_variable_get(:@data).length

$test_user = Person.find(1)

Expand Down Expand Up @@ -1550,7 +1550,7 @@ def test_caching_singleton_primary
}
}

assert_equal 2, JSONAPI.configuration.resource_cache.instance_variable_get(:@key_access).length
assert_equal 2, JSONAPI.configuration.resource_cache.instance_variable_get(:@data).length

ensure
JSONAPI.configuration = original_config
Expand Down
4 changes: 2 additions & 2 deletions test/unit/resource/resource_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PostWithBadAfterSave < ActiveRecord::Base
after_save :do_some_after_save_stuff

def do_some_after_save_stuff
errors[:base] << 'Boom! Error added in after_save callback.'
errors.add(:base, 'Boom! Error added in after_save callback.')
raise ActiveRecord::RecordInvalid.new(self)
end
end
Expand All @@ -23,7 +23,7 @@ class PostWithCustomValidationContext < ActiveRecord::Base
validate :api_specific_check, on: :json_api_create

def api_specific_check
errors[:base] << 'Record is invalid'
errors.add(:base, 'Record is invalid')
end
end

Expand Down