graphiti 1.0.rc.4 → 1.0.rc.5

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
  SHA1:
3
- metadata.gz: b694797b6438a08234c1a2a451282e5c80337b35
4
- data.tar.gz: 17ba2722107adb332c7ef6e246afe8824f3b93d4
3
+ metadata.gz: f89eebade02c792ad48a2f33c4de7eef5cc052eb
4
+ data.tar.gz: fef7fc51084562eb3e9724cd4c1419f881c086f4
5
5
  SHA512:
6
- metadata.gz: 0d029e1a07cc8008ea99368833ad1539accfaef3b4f08b8999723aafbd719b05881ee6012f825cf1da55f1625aab37943e8f49f57dc5fce4e4c7b8d41c07a338
7
- data.tar.gz: e107e440088c0a829b4970fad0ce389a82b8ab7773df1235bad70f8c664b8636140457b345b4c5e2409700ae88b6df42d3fdf8796ed08a5057ad0e9e820b308f
6
+ metadata.gz: 10e2be2bd2c6b1e80db16cf8022f446b5842eaa994f43af6688bea6816ab9a909168658fc0cd827b32c64615fa0fefbbb7f669d5df69f3ef651b25500aedf5a5
7
+ data.tar.gz: 22c268a669e839102ba34708fe666c2bf9b4efd519ab35e387f90fc748bf1211b1b6fc721180ee344052561d2c3a4dddd33a8af8991d87f44031e5c2ff76dfe7
@@ -21,8 +21,8 @@ RSpec.describe "<%= type %>#create", type: :request do
21
21
  expect(<%= resource_class %>).to receive(:build).and_call_original
22
22
  expect {
23
23
  make_request
24
+ expect(response.status).to eq(201), response.body
24
25
  }.to change { <%= model_class %>.count }.by(1)
25
- expect(response.status).to eq(201)
26
26
  end
27
27
  end
28
28
  end
@@ -10,10 +10,12 @@ RSpec.describe "<%= type %>#destroy", type: :request do
10
10
 
11
11
  it 'updates the resource' do
12
12
  expect(<%= resource_class %>).to receive(:find).and_call_original
13
- expect { make_request }.to change { <%= model_class %>.count }.by(-1)
13
+ expect {
14
+ make_request
15
+ expect(response.status).to eq(200), response.body
16
+ }.to change { <%= model_class %>.count }.by(-1)
14
17
  expect { <%= var %>.reload }
15
18
  .to raise_error(ActiveRecord::RecordNotFound)
16
- expect(response.status).to eq(200)
17
19
  expect(json).to eq('meta' => {})
18
20
  end
19
21
  end
@@ -14,7 +14,7 @@ RSpec.describe "<%= type %>#index", type: :request do
14
14
  it 'works' do
15
15
  expect(<%= resource_class %>).to receive(:all).and_call_original
16
16
  make_request
17
- expect(response.status).to eq(200)
17
+ expect(response.status).to eq(200), response.body
18
18
  expect(d.map(&:jsonapi_type).uniq).to match_array(['<%= type %>'])
19
19
  expect(d.map(&:id)).to match_array([<%= var %>1.id, <%= var %>2.id])
20
20
  end
@@ -25,8 +25,8 @@ RSpec.describe "<%= type %>#update", type: :request do
25
25
  expect(<%= resource_class %>).to receive(:find).and_call_original
26
26
  expect {
27
27
  make_request
28
+ expect(response.status).to eq(200), response.body
28
29
  }.to change { <%= var %>.reload.attributes }
29
- expect(response.status).to eq(200)
30
30
  end
31
31
  end
32
32
  end
@@ -33,10 +33,13 @@ module Graphiti
33
33
 
34
34
  # Forward all headers
35
35
  def request_headers
36
- if defined?(Rails)
37
- context.request.headers.to_h.reject { |k, v| k.include?('.') }
38
- else
39
- {}
36
+ {}.tap do |headers|
37
+ if defined?(Rails) && context
38
+ raw = context.request.headers.to_h
39
+ if auth = raw['Authorization']
40
+ headers['Authorization'] = auth
41
+ end
42
+ end
40
43
  end
41
44
  end
42
45
 
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.0.rc.4"
2
+ VERSION = "1.0.rc.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.rc.4
4
+ version: 1.0.rc.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-22 00:00:00.000000000 Z
11
+ date: 2019-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable