rspec-resembles_json_matchers 0.9.0 → 0.9.1
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 +4 -4
- data/.rubocop.yml +117 -58
- data/.travis.yml +3 -2
- data/Appraisals +7 -5
- data/Gemfile +3 -1
- data/Guardfile +6 -5
- data/LICENSE.txt +13 -0
- data/README.md +5 -0
- data/Rakefile +2 -0
- data/examples/example_spec.rb +67 -63
- data/gemfiles/.bundle/config +3 -0
- data/gemfiles/rails_5.gemfile +1 -1
- data/gemfiles/rails_5.gemfile.lock +100 -67
- data/gemfiles/{rails_42.gemfile → rails_6.gemfile} +2 -2
- data/gemfiles/rails_6.gemfile.lock +236 -0
- data/lib/rspec/resembles_json_matchers.rb +4 -3
- data/lib/rspec/resembles_json_matchers/attribute_differ.rb +38 -43
- data/lib/rspec/resembles_json_matchers/attribute_matcher.rb +2 -5
- data/lib/rspec/resembles_json_matchers/helpers.rb +4 -3
- data/lib/rspec/resembles_json_matchers/json_matcher.rb +7 -6
- data/lib/rspec/resembles_json_matchers/matcherizer.rb +2 -3
- data/lib/rspec/resembles_json_matchers/resembles_any_of_matcher.rb +9 -13
- data/lib/rspec/resembles_json_matchers/resembles_array_matcher.rb +2 -4
- data/lib/rspec/resembles_json_matchers/resembles_boolean_matcher.rb +1 -0
- data/lib/rspec/resembles_json_matchers/resembles_class_matcher.rb +2 -1
- data/lib/rspec/resembles_json_matchers/resembles_date_matcher.rb +2 -0
- data/lib/rspec/resembles_json_matchers/resembles_hash_matcher.rb +11 -11
- data/lib/rspec/resembles_json_matchers/resembles_matcher.rb +8 -16
- data/lib/rspec/resembles_json_matchers/resembles_nil_matcher.rb +1 -0
- data/lib/rspec/resembles_json_matchers/resembles_numeric_matcher.rb +2 -1
- data/lib/rspec/resembles_json_matchers/resembles_route_matcher.rb +1 -0
- data/lib/rspec/resembles_json_matchers/resembles_string_matcher.rb +1 -0
- data/lib/rspec/resembles_json_matchers/string_indent.rb +4 -2
- data/lib/rspec/resembles_json_matchers/version.rb +3 -1
- data/rspec-resembles_json_matchers.gemspec +14 -9
- metadata +66 -24
- data/gemfiles/rails_42.gemfile.lock +0 -183
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38281b311384de632c7193ac6934f3d75b7819cd398aa4f2972afb9180e21ef9
|
4
|
+
data.tar.gz: 39b792abbcdc3918090865625eeae4afa31943d5a95624a055be3b41e80872dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88c84bf302ab7c9e91708e7a6d2a8547b550f13bbe270782adb9d71543a77f2e08bfc1d9c77b27cd1114ea22ed73bbba474ded3f2c7bf46765fab07d1b3daa56
|
7
|
+
data.tar.gz: bbcd7298a08f9382232320b91c95ef999b5ec25eca8617886fb6ae8b1a1a9cd3d49371abd801757c8dccc47f67c62a2e9c6c331e39ba4945d50005cb5dc6cf1c
|
data/.rubocop.yml
CHANGED
@@ -1,96 +1,155 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
inherit_from:
|
2
|
+
- https://relaxed.ruby.style/rubocop.yml
|
3
|
+
|
4
|
+
require:
|
5
|
+
- rubocop-rspec
|
6
|
+
- rubocop-performance
|
3
7
|
|
4
8
|
AllCops:
|
5
9
|
DisplayCopNames: true
|
6
10
|
DisplayStyleGuide: true
|
7
|
-
|
8
|
-
TargetRubyVersion: 2.5
|
11
|
+
TargetRubyVersion: 2.6
|
9
12
|
|
10
|
-
Include:
|
11
|
-
- "**/Rakefile"
|
12
|
-
- "**/config.ru"
|
13
13
|
Exclude:
|
14
14
|
- "vendor/**/*"
|
15
15
|
- "spec/fixtures/**/*"
|
16
16
|
- "bin/**/*"
|
17
|
-
- "script/**/*"
|
18
|
-
- "node_modules/**/*"
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
Max: 120
|
18
|
+
Layout:
|
19
|
+
Severity: error
|
20
|
+
Lint:
|
21
|
+
Severity: error
|
25
22
|
|
23
|
+
Layout/HashAlignment:
|
24
|
+
EnforcedHashRocketStyle: table
|
25
|
+
EnforcedColonStyle: table
|
26
|
+
Layout/LineLength:
|
27
|
+
Enabled: true
|
28
|
+
Max: 140
|
29
|
+
Lint/AmbiguousBlockAssociation:
|
30
|
+
Exclude:
|
31
|
+
- "spec/**/*" # `expect { }.to change { }` is fine
|
32
|
+
Lint/BooleanSymbol:
|
33
|
+
Exclude:
|
34
|
+
- "spec/**/*" # Symbols like :true get used in these test quite a bit
|
35
|
+
Lint/ShadowingOuterLocalVariable:
|
36
|
+
# Shadowing outer local variables with block parameters is often useful to
|
37
|
+
# not reinvent a new name for the same thing, it highlights the relation
|
38
|
+
# between the outer variable and the parameter. The cases where it's actually
|
39
|
+
# confusing are rare, and usually bad for other reasons already, for example
|
40
|
+
# because the method is too long.
|
41
|
+
Enabled: false
|
26
42
|
Metrics/BlockLength:
|
43
|
+
Exclude:
|
44
|
+
- Gemfile
|
45
|
+
- Guardfile
|
46
|
+
- shared_context
|
27
47
|
ExcludedMethods:
|
28
|
-
-
|
48
|
+
- configure
|
29
49
|
- context
|
50
|
+
- define
|
51
|
+
- describe
|
30
52
|
- it
|
53
|
+
- namespace
|
31
54
|
- specify
|
55
|
+
- task
|
56
|
+
- shared_examples_for
|
57
|
+
- shared_context
|
58
|
+
- feature
|
59
|
+
Metrics/ClassLength:
|
32
60
|
Exclude:
|
33
|
-
- "
|
34
|
-
|
35
|
-
|
61
|
+
- "spec/**/*_spec.rb"
|
62
|
+
Naming/RescuedExceptionsVariableName:
|
63
|
+
PreferredName: ex
|
64
|
+
Naming/FileName:
|
36
65
|
Enabled: false
|
37
|
-
|
66
|
+
Naming/MethodName:
|
67
|
+
Enabled: false # welcome to the visitor pattern
|
68
|
+
Naming/MethodParameterName:
|
38
69
|
Enabled: false
|
39
|
-
|
70
|
+
Style/ClassAndModuleChildren:
|
40
71
|
Enabled: false
|
41
|
-
Style/
|
42
|
-
EnforcedStyle: conditionals
|
43
|
-
Layout/CaseIndentation:
|
44
|
-
IndentOneStep: true
|
45
|
-
Style/Documentation:
|
72
|
+
Style/EmptyLiteral:
|
46
73
|
Enabled: false
|
47
|
-
Style/
|
74
|
+
Style/FormatStringToken:
|
48
75
|
Enabled: false
|
49
|
-
Layout/ExtraSpacing:
|
50
|
-
Exclude:
|
51
|
-
- "config/routes.rb"
|
52
76
|
Style/FrozenStringLiteralComment:
|
53
77
|
Enabled: true
|
78
|
+
Style/HashEachMethods:
|
79
|
+
Enabled: true
|
54
80
|
Style/HashSyntax:
|
55
81
|
Exclude:
|
56
|
-
-
|
57
|
-
|
58
|
-
|
59
|
-
Style/NumericLiterals:
|
82
|
+
- Rakefile
|
83
|
+
- "**/*.rake"
|
84
|
+
Style/HashTransformKeys:
|
60
85
|
Enabled: true
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
EnforcedStyle: empty_lines_special
|
67
|
-
Style/SingleLineBlockParams:
|
86
|
+
Style/HashTransformValues:
|
87
|
+
Enabled: true
|
88
|
+
Style/MethodCallWithoutArgsParentheses:
|
89
|
+
Enabled: true
|
90
|
+
Style/NumericLiterals:
|
68
91
|
Enabled: false
|
69
92
|
Style/StringLiterals:
|
93
|
+
Enabled: true
|
70
94
|
EnforcedStyle: double_quotes
|
71
|
-
Style/StringLiteralsInInterpolation:
|
72
|
-
EnforcedStyle: double_quotes
|
73
|
-
Layout/MultilineMethodCallIndentation:
|
74
|
-
Exclude:
|
75
|
-
- "spec/**/*.rb"
|
76
|
-
Style/FormatString:
|
77
|
-
Enabled: false
|
78
|
-
Style/FormatStringToken:
|
79
|
-
Enabled: false
|
80
95
|
Style/SymbolArray:
|
81
96
|
MinSize: 4
|
82
|
-
|
83
|
-
|
84
|
-
Lint/
|
97
|
+
|
98
|
+
# 0.81
|
99
|
+
Lint/RaiseException:
|
100
|
+
Enabled: true
|
101
|
+
Lint/StructNewOverride:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
# 0.82
|
105
|
+
Layout/SpaceAroundMethodCallOperator:
|
106
|
+
Enabled: true
|
107
|
+
Style/ExponentialNotation:
|
108
|
+
Enabled: true
|
109
|
+
|
110
|
+
# 0.83
|
111
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
112
|
+
Enabled: true
|
113
|
+
Style/SlicingWithRange:
|
114
|
+
Enabled: true
|
115
|
+
|
116
|
+
# 0.84
|
117
|
+
Lint/DeprecatedOpenSSLConstant:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
# Rspec
|
121
|
+
Capybara/FeatureMethods:
|
122
|
+
Enabled: false
|
123
|
+
RSpec/ContextWording:
|
124
|
+
Enabled: false
|
125
|
+
RSpec/DescribeClass:
|
126
|
+
Enabled: false
|
127
|
+
RSpec/DescribedClass:
|
128
|
+
Enabled: false
|
129
|
+
RSpec/ExampleLength:
|
130
|
+
Max: 20
|
131
|
+
RSpec/ExampleWording:
|
132
|
+
Enabled: false
|
133
|
+
RSpec/ExpectChange:
|
134
|
+
EnforcedStyle: block
|
135
|
+
RSpec/FilePath:
|
136
|
+
Enabled: false
|
137
|
+
RSpec/ImplicitExpect:
|
138
|
+
Enabled: false
|
139
|
+
RSpec/LeadingSubject:
|
140
|
+
Enabled: false
|
141
|
+
RSpec/MessageSpies:
|
85
142
|
Enabled: false
|
86
|
-
|
143
|
+
RSpec/MultipleExpectations:
|
144
|
+
Max: 4
|
145
|
+
RSpec/NestedGroups:
|
146
|
+
Max: 4
|
147
|
+
RSpec/NotToNot:
|
87
148
|
Enabled: false
|
88
|
-
|
149
|
+
RSpec/ExpectInHook:
|
89
150
|
Enabled: false
|
90
|
-
|
91
|
-
MaxKeyValuePairs: 1
|
92
|
-
Style/ClassCheck:
|
151
|
+
RSpec/LetSetup:
|
93
152
|
Enabled: false
|
94
|
-
|
153
|
+
RSpec/NamedSubject:
|
95
154
|
Enabled: false
|
96
155
|
|
data/.travis.yml
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- "2.4"
|
4
3
|
- "2.5"
|
4
|
+
- "2.6"
|
5
|
+
- "2.7"
|
5
6
|
before_install: gem update --system && gem install bundler
|
6
7
|
gemfile:
|
7
|
-
- gemfiles/rails_42.gemfile
|
8
8
|
- gemfiles/rails_5.gemfile
|
9
|
+
- gemfiles/rails_6.gemfile
|
9
10
|
matrix:
|
10
11
|
fast_finish: true
|
11
12
|
notifications:
|
data/Appraisals
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
gem "rails", "~> 4.2"
|
3
|
-
gem "rspec", "~> 3.4"
|
4
|
-
end
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
3
|
appraise "rails-5" do
|
7
|
-
gem "rails", "~> 5.
|
4
|
+
gem "rails", "~> 5.2.0"
|
8
5
|
gem "rspec", "~> 3.6.0"
|
9
6
|
end
|
7
|
+
|
8
|
+
appraise "rails-6" do
|
9
|
+
gem "rails", "~> 6.0.0"
|
10
|
+
gem "rspec", "~> 3.9.0"
|
11
|
+
end
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# A sample Guardfile
|
2
4
|
# More info at https://github.com/guard/guard#readme
|
3
5
|
|
@@ -26,12 +28,12 @@
|
|
26
28
|
|
27
29
|
guard :rspec,
|
28
30
|
# cmd: "bin/rspec --no-profile --fail-fast",
|
29
|
-
cmd:
|
30
|
-
failed_mode:
|
31
|
-
run_all:
|
31
|
+
cmd: "bin/rspec --no-profile",
|
32
|
+
failed_mode: :focus,
|
33
|
+
run_all: { cmd: "bin/rspec --no-profile --tag ~type:feature" }, # skip feature specs on "all"
|
32
34
|
notification: true,
|
33
35
|
all_on_start: false,
|
34
|
-
all_on_pass:
|
36
|
+
all_on_pass: false do
|
35
37
|
require "guard/rspec/dsl"
|
36
38
|
dsl = Guard::RSpec::Dsl.new(self)
|
37
39
|
|
@@ -50,5 +52,4 @@ guard :rspec,
|
|
50
52
|
watch(%r{^lib/rspec/resembles_json_matchers/(.+_matcher)\.rb$}) do |m|
|
51
53
|
"spec/matchers/#{m[1]}_spec.rb"
|
52
54
|
end
|
53
|
-
|
54
55
|
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
2
|
+
Version 2, December 2004
|
3
|
+
|
4
|
+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
5
|
+
|
6
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
7
|
+
copies of this license document, and changing it is allowed as long
|
8
|
+
as the name is changed.
|
9
|
+
|
10
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
11
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
12
|
+
|
13
|
+
0. You just DO WHAT THE FUCK YOU WANT TO.
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/rspec-json_api_matchers)[](https://travis-ci.org/paul/rspec-json_api_matchers)
|
4
4
|
|
5
|
+
|
5
6
|
This gem provides a set of matchers that make testing JSON documents (actually the hashes parsed from them) simpler and more elegant.
|
6
7
|
|
7
8
|
## `resemble` Matcher
|
@@ -193,3 +194,7 @@ Or install it yourself as:
|
|
193
194
|
|
194
195
|
Bug reports and pull requests are welcome on GitHub at https://github.com/paul/rspec-json_api_matchers.
|
195
196
|
|
197
|
+
## License
|
198
|
+
|
199
|
+
|
200
|
+
[][http://www.wtfpl.net/]
|
data/Rakefile
CHANGED
data/examples/example_spec.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative "../spec/spec_helper"
|
2
4
|
|
3
5
|
RSpec.describe "The resembles json matcher" do
|
4
6
|
include RSpec::ResemblesJsonMatchers
|
5
7
|
|
6
|
-
before :
|
8
|
+
before :suite do
|
7
9
|
puts <<~WARNING
|
8
10
|
NOTE: some of these are expected to fail, they are meant to demonstrate
|
9
11
|
the output generated by failing specs
|
@@ -13,11 +15,11 @@ RSpec.describe "The resembles json matcher" do
|
|
13
15
|
describe "a basic json document" do
|
14
16
|
let(:document) do
|
15
17
|
{
|
16
|
-
"@id":
|
17
|
-
"@type":
|
18
|
-
"title":
|
19
|
-
"body":
|
20
|
-
"created_at":
|
18
|
+
"@id": "/posts/2016/test1",
|
19
|
+
"@type": "Post",
|
20
|
+
"title": "Hello World!",
|
21
|
+
"body": "lorem ipsum",
|
22
|
+
"created_at": "2016-03-01T00:03:42",
|
21
23
|
"published_at": "2016-03-10T15:35:00"
|
22
24
|
}
|
23
25
|
end
|
@@ -25,11 +27,11 @@ RSpec.describe "The resembles json matcher" do
|
|
25
27
|
specify do
|
26
28
|
expect(document).to resemble_json(
|
27
29
|
{
|
28
|
-
"@id":
|
29
|
-
"@type":
|
30
|
-
"title":
|
31
|
-
"body":
|
32
|
-
"created_at":
|
30
|
+
"@id": "/posts/:year/:title",
|
31
|
+
"@type": eq("Post"),
|
32
|
+
"title": "Hello World!",
|
33
|
+
"body": "lorem ipsum",
|
34
|
+
"created_at": "2016-03-01T00:03:42",
|
33
35
|
"published_at": "2016-03-10T15:35:00"
|
34
36
|
}
|
35
37
|
)
|
@@ -39,11 +41,11 @@ RSpec.describe "The resembles json matcher" do
|
|
39
41
|
specify do
|
40
42
|
expect(document).to resemble_json(
|
41
43
|
{
|
42
|
-
"@id":
|
43
|
-
"@type":
|
44
|
-
"title":
|
45
|
-
"body":
|
46
|
-
"created_at":
|
44
|
+
"@id": "/posts/:year/:title",
|
45
|
+
"@type": eq("PostCollection"),
|
46
|
+
"title": 42.0,
|
47
|
+
"body": "lorem ipsum",
|
48
|
+
"created_at": "2016-03-01T00:03:42",
|
47
49
|
"published_at": "2016-03-10T15:35:00"
|
48
50
|
}
|
49
51
|
)
|
@@ -54,10 +56,10 @@ RSpec.describe "The resembles json matcher" do
|
|
54
56
|
specify do
|
55
57
|
expect(document).to resemble_json(
|
56
58
|
{
|
57
|
-
"@id":
|
58
|
-
"@type":
|
59
|
-
"body":
|
60
|
-
"created_at":
|
59
|
+
"@id": "/posts/:year/:title",
|
60
|
+
"@type": eq("Post"),
|
61
|
+
"body": "lorem ipsum",
|
62
|
+
"created_at": "2016-03-01T00:03:42",
|
61
63
|
"published_at": "2016-03-10T15:35:00"
|
62
64
|
}
|
63
65
|
)
|
@@ -68,11 +70,13 @@ RSpec.describe "The resembles json matcher" do
|
|
68
70
|
specify do
|
69
71
|
expect(document).to resemble_json(
|
70
72
|
{
|
71
|
-
"@id":
|
72
|
-
"@type":
|
73
|
-
"
|
74
|
-
"
|
75
|
-
"
|
73
|
+
"@id": "/posts/:year/:title",
|
74
|
+
"@type": eq("Post"),
|
75
|
+
"title": "Hello World!",
|
76
|
+
"body": "lorem ipsum",
|
77
|
+
"created_at": "2016-03-01T00:03:42",
|
78
|
+
"published_at": "2016-03-10T15:35:00",
|
79
|
+
"updated_at": "2016-03-10T15:40:00"
|
76
80
|
}
|
77
81
|
)
|
78
82
|
end
|
@@ -82,16 +86,16 @@ RSpec.describe "The resembles json matcher" do
|
|
82
86
|
describe "complex nested json documents" do
|
83
87
|
let(:document) do
|
84
88
|
{
|
85
|
-
"@id":
|
86
|
-
"@type":
|
89
|
+
"@id": "/posts",
|
90
|
+
"@type": "PostCollection",
|
87
91
|
"nextPage": "/posts?page=2",
|
88
|
-
"members":
|
92
|
+
"members": [
|
89
93
|
{
|
90
|
-
"@id":
|
91
|
-
"@type":
|
92
|
-
"title":
|
93
|
-
"body":
|
94
|
-
"created_at":
|
94
|
+
"@id": "/posts/2016/test1",
|
95
|
+
"@type": "Post",
|
96
|
+
"title": "Hello World!",
|
97
|
+
"body": "lorem ipsum",
|
98
|
+
"created_at": "2016-03-01T00:03:42",
|
95
99
|
"published_at": "2016-03-10T15:35:00"
|
96
100
|
}
|
97
101
|
]
|
@@ -101,16 +105,16 @@ RSpec.describe "The resembles json matcher" do
|
|
101
105
|
specify do
|
102
106
|
expect(document).to resemble_json(
|
103
107
|
{
|
104
|
-
"@id":
|
105
|
-
"@type":
|
108
|
+
"@id": "/posts",
|
109
|
+
"@type": eq("PostCollection"),
|
106
110
|
"nextPage": "/posts?page=2",
|
107
|
-
"members":
|
111
|
+
"members": [
|
108
112
|
{
|
109
|
-
"@id":
|
110
|
-
"@type":
|
111
|
-
"title":
|
112
|
-
"body":
|
113
|
-
"created_at":
|
113
|
+
"@id": "/posts/:year/:title",
|
114
|
+
"@type": eq("Post"),
|
115
|
+
"title": "Hello World!",
|
116
|
+
"body": "lorem ipsum",
|
117
|
+
"created_at": "2016-03-01T00:03:42",
|
114
118
|
"published_at": "2016-03-10T15:35:00"
|
115
119
|
}
|
116
120
|
]
|
@@ -122,11 +126,11 @@ RSpec.describe "The resembles json matcher" do
|
|
122
126
|
describe "empty nested documents" do
|
123
127
|
let(:document) do
|
124
128
|
{
|
125
|
-
"@id":
|
126
|
-
"@type":
|
127
|
-
"title":
|
128
|
-
"body":
|
129
|
-
"created_at":
|
129
|
+
"@id": "/posts/2016/test1",
|
130
|
+
"@type": "Post",
|
131
|
+
"title": "Hello World!",
|
132
|
+
"body": "lorem ipsum",
|
133
|
+
"created_at": "2016-03-01T00:03:42",
|
130
134
|
"published_at": "2016-03-10T15:35:00"
|
131
135
|
}
|
132
136
|
end
|
@@ -134,15 +138,15 @@ RSpec.describe "The resembles json matcher" do
|
|
134
138
|
specify do
|
135
139
|
expect(document).to resemble_json(
|
136
140
|
{
|
137
|
-
"@id":
|
138
|
-
"@type":
|
139
|
-
"title":
|
140
|
-
"body":
|
141
|
-
"author":
|
142
|
-
"@id":
|
141
|
+
"@id": "/posts/:year/:title",
|
142
|
+
"@type": eq("Post"),
|
143
|
+
"title": "Hello World!",
|
144
|
+
"body": "lorem ipsum",
|
145
|
+
"author": {
|
146
|
+
"@id": "/authors/:id",
|
143
147
|
"name": eq("Paul")
|
144
148
|
},
|
145
|
-
"created_at":
|
149
|
+
"created_at": "2016-03-01T00:03:42",
|
146
150
|
"published_at": "2016-03-10T15:35:00"
|
147
151
|
}
|
148
152
|
)
|
@@ -152,8 +156,8 @@ RSpec.describe "The resembles json matcher" do
|
|
152
156
|
describe "empty nested array documents" do
|
153
157
|
let(:document) do
|
154
158
|
{
|
155
|
-
"@id":
|
156
|
-
"@type":
|
159
|
+
"@id": "/posts",
|
160
|
+
"@type": "PostCollection",
|
157
161
|
"nextPage": "/posts?page=2"
|
158
162
|
}
|
159
163
|
end
|
@@ -161,16 +165,16 @@ RSpec.describe "The resembles json matcher" do
|
|
161
165
|
specify do
|
162
166
|
expect(document).to resemble_json(
|
163
167
|
{
|
164
|
-
"@id":
|
165
|
-
"@type":
|
168
|
+
"@id": "/posts",
|
169
|
+
"@type": eq("PostCollection"),
|
166
170
|
"nextPage": "/posts?page=2",
|
167
|
-
"members":
|
171
|
+
"members": [
|
168
172
|
{
|
169
|
-
"@id":
|
170
|
-
"@type":
|
171
|
-
"title":
|
172
|
-
"body":
|
173
|
-
"created_at":
|
173
|
+
"@id": "/posts/:year/:title",
|
174
|
+
"@type": eq("Post"),
|
175
|
+
"title": "Hello World!",
|
176
|
+
"body": "lorem ipsum",
|
177
|
+
"created_at": "2016-03-01T00:03:42",
|
174
178
|
"published_at": "2016-03-10T15:35:00"
|
175
179
|
}
|
176
180
|
]
|