jsonapi-rspec 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c6811a07f15a3e68d69b7ba45fc6df97c649d21e3b2a8df38fb493c6a20b615
4
- data.tar.gz: da564714ee866647007b624ec7c871c2834949ec6a5d7987622f39df15e72458
3
+ metadata.gz: fa7320e501ff0cc08655a6e935589d300bedef20bc70add21f64d91d2e053a36
4
+ data.tar.gz: 1d31cafea53bb133cc8c62c274403bad9aaaa7dfcf4834679bd4cf2dbd246a8c
5
5
  SHA512:
6
- metadata.gz: 25715dae1b5adfcfc2e2e327d7042ee035efbd7123dd3bb36be939ff1e412a16bda3765f304ecc6304f446eab52a3584954cc0f0334fff4501143f06f450f81d
7
- data.tar.gz: f95632ad22f0b9b74fd5315e39f2ea800c7c1062b53845357d7312f3d1d7831faae4e476c2981d59acef81c2bc510200ecbd33bbced0bdf21a9ccba18f1da8a7
6
+ metadata.gz: 727c5d55cfa976e4961dfe9798d1767bde29b364d7e4ff33dd52541a12c719c45f67bc021fd179432bd37ae60d26bc8477dce288eadb4b6365d0575570d3c6f0
7
+ data.tar.gz: bc74dd39b5b8186f7f6d945277f4fd8a091a20f9c33febf4ed52a788ac54778c6d176e20861261d5e7ef60a061cefdaf1fbefb4eaf63ff5163e661ee378ffde0
data/README.md CHANGED
@@ -2,11 +2,6 @@
2
2
 
3
3
  RSpec matchers for [JSON API](http://jsonapi.org).
4
4
 
5
- ## Resources
6
-
7
- * Chat: [gitter](http://gitter.im/jsonapi-rb)
8
- * Twitter: [@jsonapirb](http://twitter.com/jsonapirb)
9
-
10
5
  ## Installation
11
6
 
12
7
  Add the following to your application's Gemfile:
@@ -30,6 +25,7 @@ RSpec.configure do |config|
30
25
  # Support for documents with mixed string/symbol keys. Disabled by default.
31
26
  config.jsonapi_indifferent_hash = true
32
27
  end
28
+ ```
33
29
 
34
30
  ## Usage and documentation
35
31
 
@@ -46,6 +42,7 @@ Available matchers:
46
42
  * `expect(document['data']).to have_link(:self).with_value('http://api.example.com/users/12')`
47
43
  * `expect(document).to have_meta`
48
44
  * `expect(document).to have_meta('foo' => 'bar')`
45
+ * `expect(document).to have_meta('foo' => 'bar', 'fum' => 'baz').exactly`
49
46
  * `expect(document).to have_jsonapi_object`
50
47
  * `expect(document).to have_jsonapi_object('version' => '1.0')`
51
48
 
@@ -1,5 +1,6 @@
1
1
  require 'json'
2
2
  require 'rspec/matchers'
3
+ require 'rspec/core'
3
4
  require 'jsonapi/rspec/id'
4
5
  require 'jsonapi/rspec/type'
5
6
  require 'jsonapi/rspec/attributes'
@@ -4,9 +4,17 @@ module JSONAPI
4
4
  ::RSpec::Matchers.define :have_meta do |val|
5
5
  match do |actual|
6
6
  actual = JSONAPI::RSpec.as_indifferent_hash(actual)
7
+ return false unless actual.key?('meta')
8
+ return true unless val
9
+
7
10
  val = JSONAPI::RSpec.as_indifferent_hash(val)
11
+ return false unless val <= actual['meta']
12
+
13
+ !@exactly || (@exactly && val.size == actual['meta'].size)
14
+ end
8
15
 
9
- actual.key?('meta') && (!val || actual['meta'] == val)
16
+ chain :exactly do
17
+ @exactly = true
10
18
  end
11
19
  end
12
20
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Hosseini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-29 00:00:00.000000000 Z
11
+ date: 2020-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rspec-expectations
15
29
  requirement: !ruby/object:Gem::Requirement