Skip to content
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

Support for ruby 3 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.ruby-*
.bundle/
Gemfile.lock
coverage/
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ rvm:
- 2.5
- 2.6
- 2.7
- 3.0
env:
- 'RAILS_VERSION="5.1" AMS_VERSION="0.10.7"'
- 'RAILS_VERSION="5.2" AMS_VERSION="0.10.12"'
- 'RAILS_VERSION="6.1" AMS_VERSION="0.10.13"'
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gemspec

gem 'rake', '< 11.0'

rails_version = ENV['RAILS_VERSION'] || '5.2'
rails_version = ENV.fetch('RAILS_VERSION', '5.2')
if rails_version == 'master'
gem 'rails', github: 'rails/rails'
else
Expand Down
2 changes: 1 addition & 1 deletion fun_with_json_api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.add_dependency 'rails', '>= 5.1'
s.add_dependency 'active_model_serializers', '>= 0.10.0'

s.add_development_dependency 'sqlite3', '~> 1.3.6'
s.add_development_dependency 'sqlite3', '~> 1.4'
s.add_development_dependency 'rspec-rails'
s.add_development_dependency 'faker'
s.add_development_dependency 'rubocop', '~> 0.38.0'
Expand Down
4 changes: 2 additions & 2 deletions lib/fun_with_json_api/find_collection_from_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

module FunWithJsonApi
class FindCollectionFromDocument
def self.find(*args)
new(*args).find
def self.find(...)
new(...).find
end

private_class_method :new
Expand Down
4 changes: 2 additions & 2 deletions lib/fun_with_json_api/find_resource_from_document.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module FunWithJsonApi
class FindResourceFromDocument
def self.find(*args)
new(*args).find
def self.find(...)
new(...).find
end

private_class_method :new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module FunWithJsonApi
module SchemaValidators
class CheckCollectionHasAllMembers
def self.call(*args)
new(*args).call
def self.call(...)
new(...).call
end

attr_reader :collection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module FunWithJsonApi
module SchemaValidators
class CheckCollectionIsAuthorised
def self.call(*args)
new(*args).call
def self.call(...)
new(...).call
end

attr_reader :collection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module FunWithJsonApi
module SchemaValidators
# Ensures all provided relationship names are known
class CheckRelationshipNames
def self.call(*args)
new(*args).call
def self.call(...)
new(...).call
end

attr_reader :document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module FunWithJsonApi
module SchemaValidators
class CheckResourceIsAuthorised
def self.call(*args)
new(*args).call
def self.call(...)
new(...).call
end

attr_reader :resource
Expand Down
2 changes: 1 addition & 1 deletion lib/fun_with_json_api/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module FunWithJsonApi
VERSION = '0.0.13'.freeze
VERSION = '0.0.14'.freeze
end
2 changes: 1 addition & 1 deletion spec/fixtures/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
t.text :contents
t.references :author
t.references :post
t.timestamp null: false
t.timestamps null: false
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/fun_with_json_api/controller_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def index
it 'returns a json api error status' do
get :index
expect(response.status).to eq 403
expect(response.content_type).to eq 'application/vnd.api+json'
expect(response.content_type).to include('application/vnd.api+json')
end

it 'renders the exception payload as a json api errors response' do
Expand Down Expand Up @@ -77,7 +77,7 @@ def index
it 'returns a json api error status' do
get :index
expect(response.status).to eq 403
expect(response.content_type).to eq 'application/vnd.api+json'
expect(response.content_type).to include('application/vnd.api+json')
end

it 'renders all exception payload items' do
Expand Down Expand Up @@ -108,7 +108,7 @@ def index
it 'returns a json api error status' do
get :index
expect(response.status).to eq 422
expect(response.content_type).to eq 'application/vnd.api+json'
expect(response.content_type).to include('application/vnd.api+json')
end

it 'only renders the non-nil params' do
Expand Down
4 changes: 2 additions & 2 deletions spec/fun_with_json_api/railtie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def index

it 'renders out the hash as a json_api response' do
get :index
expect(response.content_type).to eq 'application/vnd.api+json'
expect(response.content_type).to include('application/vnd.api+json')
expect(JSON.parse(response.body)).to eq(
'data' => { 'id' => '42', 'type' => 'foobar' }
)
Expand All @@ -66,7 +66,7 @@ def index

it 'renders the resource as a json api document' do
get :index
expect(response.content_type).to eq 'application/vnd.api+json'
expect(response.content_type).to include('application/vnd.api+json')
expect(JSON.parse(response.body)).to eq(
'data' => {
'id' => '42',
Expand Down