jsonapi-realizer 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 249bd86429ad678910d08bac26aa46fc25e6d22a326aef4c613c59bb1f8d7ace
4
- data.tar.gz: ecc579c9998df302d71287d348fa4fe83c879913520f5d939b88e57af3dd6adf
3
+ metadata.gz: 02f40c79b4a4ecf49431c220d161c065737e744f420250dec013011c11647af5
4
+ data.tar.gz: 923505a0c13a519bf0db6aa7b2ce260884a9bfd309476987e32e802f0affc0bc
5
5
  SHA512:
6
- metadata.gz: e4f9fd5458983657b7ac6ad4ae84f4dcbfb00ffbb95366f4f28d180081e9a54baebd799d059be21a14aedc778eadd5113b68d5b57c48e02032b3bf05289370db
7
- data.tar.gz: 268221f1161db90714f3c4660468948a6f30349256b2f14e22a0e65212875dfae0fef5a5b23ed7826528500bca40fb7ee6027ea9da54ab3e07e2765ccc196484
6
+ metadata.gz: d6c3c50ddb0321258311a199b4e2c4eb7946ec35981865696662cad16563d40bbdb8d745f9e215cfb5fdc894fa54897410cf3bf347ac7eeb14015271a74f38e5
7
+ data.tar.gz: 710585e9ed18604598d2eb52ac48e935ae3cfb85f462b84284fee06a2d660f2df3b6896a33ce3ba86a063843de28b5ea07c18e132666cda3e511e841fef9fcac
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Realizer
3
- VERSION = "2.0.2"
3
+ VERSION = "2.0.3"
4
4
  end
5
5
  end
@@ -30,7 +30,7 @@ module JSONAPI
30
30
  end
31
31
 
32
32
  def self.create(payload, headers:)
33
- enact(Create.new(payload: payload, headers: headers))
33
+ enact(Action::Create.new(payload: payload, headers: headers))
34
34
  end
35
35
 
36
36
  def self.update(payload, headers:)
@@ -36,7 +36,7 @@ RSpec.describe JSONAPI::Realizer do
36
36
  end
37
37
 
38
38
  it "returns an action that has N models" do
39
- expect(subject).to have_attributes(models: array_including(a_kind_of(Photo)))
39
+ expect(subject).to have_attributes(models: [a_kind_of(Photo), a_kind_of(Photo)])
40
40
  end
41
41
  end
42
42
  end
@@ -65,11 +65,6 @@ RSpec.describe JSONAPI::Realizer do
65
65
  end
66
66
 
67
67
  before do
68
- Photo::STORE["550e8400-e29b-41d4-a716-446655440000"] = {
69
- id: "550e8400-e29b-41d4-a716-446655440000",
70
- title: "Ember Hamster",
71
- src: "http://example.com/images/productivity.png"
72
- }
73
68
  Photo::STORE["d09ae4c6-0fc3-4c42-8fe8-6029530c3bed"] = {
74
69
  id: "d09ae4c6-0fc3-4c42-8fe8-6029530c3bed",
75
70
  title: "Ember Fox",
@@ -82,4 +77,50 @@ RSpec.describe JSONAPI::Realizer do
82
77
  end
83
78
  end
84
79
  end
80
+
81
+ describe ".create" do
82
+ subject { JSONAPI::Realizer.create(payload, headers: headers) }
83
+
84
+ context "with no top-level data and good headers"
85
+ context "with no top-level data and bad headers"
86
+ context "with a good payload and bad headers"
87
+
88
+ context "with a good payload and good headers" do
89
+ let(:payload) do
90
+ {
91
+ "data" => {
92
+ "id" => "550e8400-e29b-41d4-a716-446655440000",
93
+ "type" => "photos",
94
+ "attributes" => {
95
+ "title" => "Ember Hamster",
96
+ "alt-text" => "A hamster logo.",
97
+ "src" => "http://example.com/images/productivity.png"
98
+ },
99
+ "relationships" => {
100
+ "active-photographer" => {
101
+ "data" => { "type" => "photographer-people", "id" => "4b8a0af6-953d-4729-8b9a-1fa4eb18f3c9" }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ end
107
+ let(:headers) do
108
+ {
109
+ "Content-Type" => "application/vnd.api+json",
110
+ "Accept" => "application/vnd.api+json"
111
+ }
112
+ end
113
+
114
+ before do
115
+ People::STORE["4b8a0af6-953d-4729-8b9a-1fa4eb18f3c9"] = {
116
+ id: "4b8a0af6-953d-4729-8b9a-1fa4eb18f3c9",
117
+ name: "Kurtis Rainbolt-Greene"
118
+ }
119
+ end
120
+
121
+ it "returns an action that a model" do
122
+ expect(subject).to have_attributes(model: a_kind_of(Photo))
123
+ end
124
+ end
125
+ end
85
126
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-realizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurtis Rainbolt-Greene