Skip to content

Commit 711abc6

Browse files
committed
tests pass
1 parent d9f17c3 commit 711abc6

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ eval_gemfile local_gemfile if File.readable?(local_gemfile)
77
# Specify your gem's dependencies in active_model_serializers.gemspec
88
gemspec
99

10+
# TODO: remove when @beauby re-publishes this gem
11+
gem 'jsonapi', github: 'beauby/jsonapi'
12+
1013
version = ENV['RAILS_VERSION'] || '4.2'
1114

1215
if version == 'master'

active_model_serializers.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
4343
# 'thread_safe'
4444

4545
spec.add_runtime_dependency 'jsonapi', '~> 0.1.1.beta2'
46-
spec.add_runtime_dependency 'case_transform', '>= 0.1'
46+
spec.add_runtime_dependency 'case_transform', '>= 0.2'
4747

4848
spec.add_development_dependency 'activerecord', rails_versions
4949
# arel

lib/active_model_serializers/adapter/json_api/deserialization.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module Deserialization
7474
#
7575
def parse!(document, options = {})
7676
parse(document, options) do |invalid_payload, reason|
77-
fail JSONAPI::InvalidDocument, "Invalid payload (#{reason}): #{invalid_payload}"
77+
fail JSONAPI::Parser::InvalidDocument, "Invalid payload (#{reason}): #{invalid_payload}"
7878
end
7979
end
8080

@@ -102,7 +102,7 @@ def parse(document, options = {})
102102

103103
hash
104104

105-
rescue JSONAPI::InvalidDocument
105+
rescue JSONAPI::Parser::InvalidDocument
106106
return {} unless block_given?
107107
yield
108108
end

test/adapter/json_api/parse_test.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def setup
4444
{ 'data' => { 'attributes' => [] } },
4545
{ 'data' => { 'relationships' => [] } },
4646
{ 'data' => { 'relationships' => { 'rel' => nil } } },
47-
{ 'data' => { 'relationships' => { 'rel' => {} } } }
48-
]
47+
{ 'data' => { 'relationships' => { 'rel' => {} } } }]
4948
end
5049

5150
def test_hash
@@ -73,7 +72,7 @@ def test_illformed_payloads_safe
7372

7473
def test_illformed_payloads_unsafe
7574
@illformed_payloads.each do |p|
76-
assert_raises(JSONAPI::InvalidDocument) do
75+
assert_raises(JSONAPI::Parser::InvalidDocument) do
7776
ActiveModelSerializers::Adapter::JsonApi::Deserialization.parse!(p)
7877
end
7978
end

0 commit comments

Comments
 (0)