rspec-json_api 1.1.1 → 1.2.0

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: 6f40d1a16f0eff4c046c4598ace80041df867575e52065a1b1dd298ec9cf98d6
4
- data.tar.gz: 8aae365879c35374679dac663a490bdb5018a3646f8b30e64836700220aed5fb
3
+ metadata.gz: 926364f56a7d6913ba3ffc9f3247268727e8510cae6941aa6918f3101c3ecd27
4
+ data.tar.gz: 272e73fbd9562c005fdb1d3ac50e17cee84aa22e8e0383d0eb15d2d6606dd4c7
5
5
  SHA512:
6
- metadata.gz: 8a5b5fe0e572b4e1424ebd7e32d1d0178046ee111e1c9e69f09fbae69eda8c273fd98498570c6ab7a4b58c12b214d11bfd8eec701e1b4502770826cd2c1cf724
7
- data.tar.gz: 82afdf75029cd84a8ae8bd84335a4ef48e5dab5db0682018a79a2f799991fcc1af8c069fd01abd3905fe4ee468e46d28cbc615e0cf4d5c8e80133e10abd309d7
6
+ metadata.gz: 4be67b6d2146f39576b7766e7dc9eeda0ea7530f63e97e5cbb503424d3e95a0b7607e798f09acee83efeadde2e504df74b1dfcd3678082b518024c0d70917066
7
+ data.tar.gz: 4b723f4a170f36e563e7663c7e22286850ab60f376bd166db4a76476dc2faa3ca08fe055713419498657c5c52f4b6c609e3a8e27fba80c913ef5495ce0ed7932
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-json_api (1.1.0)
4
+ rspec-json_api (1.1.1)
5
5
  activesupport (>= 6.1.4.1)
6
6
  rails (>= 6.1.4.1)
7
7
  rspec-rails (>= 5.0.2)
@@ -91,16 +91,16 @@ GEM
91
91
  mini_mime (1.1.5)
92
92
  mini_portile2 (2.7.1)
93
93
  minitest (5.15.0)
94
- net-imap (0.4.4)
94
+ net-imap (0.4.9.1)
95
95
  date
96
96
  net-protocol
97
97
  net-pop (0.1.2)
98
98
  net-protocol
99
99
  net-protocol (0.2.2)
100
100
  timeout
101
- net-smtp (0.4.0)
101
+ net-smtp (0.4.0.1)
102
102
  net-protocol
103
- nio4r (2.5.9)
103
+ nio4r (2.7.0)
104
104
  nokogiri (1.13.1)
105
105
  mini_portile2 (~> 2.7.0)
106
106
  racc (~> 1.4)
data/README.md CHANGED
@@ -66,6 +66,14 @@ RSpec.describe UsersController, type: :controller do
66
66
  expect(response.body).to match_json_schema(expected_schema)
67
67
  end
68
68
  end
69
+
70
+ describe '#update' do
71
+ it 'matches API response' do
72
+ put :update, params: { name: 'John', age: 35 }
73
+
74
+ expect(response.body).to have_no_content
75
+ end
76
+ end
69
77
  end
70
78
  ```
71
79
 
@@ -75,6 +83,11 @@ end
75
83
  expect(response.body).to match_json_schema(expected_schema)
76
84
  ```
77
85
 
86
+ - ### have_no_content
87
+ ```
88
+ expect(response.body).to have_no_content
89
+ ```
90
+
78
91
  ## Interfaces
79
92
  The gem introduces interfaces to reuse them during test matches.
80
93
 
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RSpec
4
+ module JsonApi
5
+ module Matchers
6
+ class HaveNoContent
7
+ def matches?(actual)
8
+ actual == ""
9
+ end
10
+
11
+ def failure_message
12
+ self
13
+ end
14
+
15
+ def failure_message_when_negated
16
+ self
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -11,6 +11,7 @@ module RSpec
11
11
  end
12
12
 
13
13
  def matches?(actual)
14
+ # Parse JSON to ruby object
14
15
  actual = JSON.parse(actual, symbolize_names: true)
15
16
 
16
17
  # Compare types
@@ -5,5 +5,9 @@ module RSpec
5
5
  def match_json_schema(expected)
6
6
  RSpec::JsonApi::Matchers::MatchJsonSchema.new(expected)
7
7
  end
8
+
9
+ def have_no_content
10
+ RSpec::JsonApi::Matchers::HaveNoContent.new
11
+ end
8
12
  end
9
13
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module JsonApi
5
- VERSION = "1.1.1"
5
+ VERSION = "1.2.0"
6
6
  end
7
7
  end
@@ -15,6 +15,7 @@ require "extentions/hash"
15
15
  # Load matchers
16
16
  require "rspec/json_api/matchers"
17
17
  require "rspec/json_api/matchers/match_json_schema"
18
+ require "rspec/json_api/matchers/have_no_content"
18
19
 
19
20
  # Load defined types
20
21
  require "rspec/json_api/types/email"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-json_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Gajowiak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-07 00:00:00.000000000 Z
11
+ date: 2024-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -85,6 +85,7 @@ files:
85
85
  - lib/rspec/json_api/compare_hash.rb
86
86
  - lib/rspec/json_api/interfaces/example_interface.rb
87
87
  - lib/rspec/json_api/matchers.rb
88
+ - lib/rspec/json_api/matchers/have_no_content.rb
88
89
  - lib/rspec/json_api/matchers/match_json_schema.rb
89
90
  - lib/rspec/json_api/types/email.rb
90
91
  - lib/rspec/json_api/types/uri.rb