diff --git a/jsonapi.rb.gemspec b/jsonapi.rb.gemspec index c112540..2d82832 100644 --- a/jsonapi.rb.gemspec +++ b/jsonapi.rb.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'ransack' spec.add_development_dependency 'railties', ENV['RAILS_VERSION'] spec.add_development_dependency 'activerecord', ENV['RAILS_VERSION'] - spec.add_development_dependency 'sqlite3', '~> 1.7' + spec.add_development_dependency 'sqlite3', '~> 2.1' spec.add_development_dependency 'ffaker' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'rspec-rails' diff --git a/lib/jsonapi/errors.rb b/lib/jsonapi/errors.rb index 1ecca5e..5b25425 100644 --- a/lib/jsonapi/errors.rb +++ b/lib/jsonapi/errors.rb @@ -47,7 +47,7 @@ def render_jsonapi_not_found(exception) render jsonapi_errors: [error], status: :not_found end - # Unprocessable entity (422) error handler callback + # Unprocessable Content (422) error handler callback # # @param exception [Exception] instance to handle # @return [String] JSONAPI error response diff --git a/lib/jsonapi/pagination.rb b/lib/jsonapi/pagination.rb index 5502e17..9c6ef65 100644 --- a/lib/jsonapi/pagination.rb +++ b/lib/jsonapi/pagination.rb @@ -29,7 +29,7 @@ def jsonapi_paginate(resources) # # @return [Array] def jsonapi_pagination(resources) - links = { self: request.base_url + request.fullpath } + links = { self: request.base_url + CGI.unescape(request.fullpath) } pagination = jsonapi_pagination_meta(resources) return links if pagination.blank? diff --git a/spec/dummy.rb b/spec/dummy.rb index c2e32ef..dd2c0ec 100644 --- a/spec/dummy.rb +++ b/spec/dummy.rb @@ -84,7 +84,6 @@ class UserSerializer end class Dummy < Rails::Application - secrets.secret_key_base = '_' config.hosts << 'www.example.com' if config.respond_to?(:hosts) routes.draw do diff --git a/spec/errors_spec.rb b/spec/errors_spec.rb index a704a63..c817a9c 100644 --- a/spec/errors_spec.rb +++ b/spec/errors_spec.rb @@ -36,7 +36,7 @@ { 'status' => '422', 'source' => { 'pointer' => '' }, - 'title' => 'Unprocessable Entity', + 'title' => 'Unprocessable Content', 'detail' => nil, 'code' => nil } @@ -63,7 +63,7 @@ { 'status' => '422', 'source' => { 'pointer' => '/data/relationships/user' }, - 'title' => 'Unprocessable Entity', + 'title' => 'Unprocessable Content', 'detail' => expected_detail, 'code' => 'blank' } @@ -85,21 +85,21 @@ { 'status' => '422', 'source' => { 'pointer' => '/data/attributes/title' }, - 'title' => 'Unprocessable Entity', + 'title' => 'Unprocessable Content', 'detail' => 'Title is invalid', 'code' => 'invalid' }, { 'status' => '422', 'source' => { 'pointer' => '/data/attributes/title' }, - 'title' => 'Unprocessable Entity', + 'title' => 'Unprocessable Content', 'detail' => 'Title has typos', 'code' => 'invalid' }, { 'status' => '422', 'source' => { 'pointer' => '/data/attributes/quantity' }, - 'title' => 'Unprocessable Entity', + 'title' => 'Unprocessable Content', 'detail' => 'Quantity must be less than 100', 'code' => 'less_than' } @@ -121,7 +121,7 @@ { 'status' => '422', 'source' => { 'pointer' => '' }, - 'title' => 'Unprocessable Entity', + 'title' => 'Unprocessable Content', 'detail' => 'Title has slurs', 'code' => 'title_has_slurs' } @@ -144,7 +144,7 @@ { 'status' => '422', 'source' => { 'pointer' => '/data/attributes/title' }, - 'title' => 'Unprocessable Entity', + 'title' => 'Unprocessable Content', 'detail' => nil, 'code' => nil }