rspec-json_expectations 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +10 -10
- data/bin/build +1 -1
- data/features/rspec/json_expectations/rspec_matchers_support.feature +1 -1
- data/lib/rspec/json_expectations.rb +1 -0
- data/lib/rspec/json_expectations/matcher_factory.rb +11 -30
- data/lib/rspec/json_expectations/matchers.rb +2 -0
- data/lib/rspec/json_expectations/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d28854e379cee30a9d153b39e16f4d5e265699a
|
4
|
+
data.tar.gz: 6a27333ceba6c6662d71b9aebf8ab9e21254a8ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf7a7056e0adaebae13d1d8e6d1f958bafd0976294b3dbfed2c33c11d9f8fb4dd8b458d43d1170bcf2255c9a33b54a7792aa1579acc4aef48257692abb7a058a
|
7
|
+
data.tar.gz: 107150eb64c10d9313b2eacddf102fef5c0206b57eac067f64914da312977a10b9a0138eb3c8aa4261ef8449364b166fbea3ee8426ee3bfcdc09f3ea1545f119
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/waterlink/rspec-json_expectations.svg?branch=master)](https://travis-ci.org/waterlink/rspec-json_expectations)
|
4
4
|
|
5
|
-
Set of matchers and helpers to allow you test your
|
5
|
+
Set of matchers and helpers for RSpec 3 to allow you test your JSON API responses like a pro.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -43,7 +43,7 @@ RSpec.describe "User API" do
|
|
43
43
|
name: "John"
|
44
44
|
)
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
it "has some additional info about user" do
|
48
48
|
expect(subject).to include_json(
|
49
49
|
premium: "gold",
|
@@ -62,27 +62,27 @@ Failures:
|
|
62
62
|
|
63
63
|
1) User API has basic info about user
|
64
64
|
Failure/Error: expect(subject).to include_json(
|
65
|
-
|
65
|
+
|
66
66
|
json atom at path "id" is not equal to expected value:
|
67
|
-
|
67
|
+
|
68
68
|
expected: 25
|
69
69
|
got: 37
|
70
|
-
|
70
|
+
|
71
71
|
json atom at path "name" is not equal to expected value:
|
72
|
-
|
72
|
+
|
73
73
|
expected: "John"
|
74
74
|
got: "Smith J."
|
75
|
-
|
75
|
+
|
76
76
|
# ./spec/user_api_spec.rb:18:in `block (2 levels) in <top (required)>'
|
77
77
|
|
78
78
|
2) User API has some additional info about user
|
79
79
|
Failure/Error: expect(subject).to include_json(
|
80
|
-
|
80
|
+
|
81
81
|
json atom at path "premium" is not equal to expected value:
|
82
|
-
|
82
|
+
|
83
83
|
expected: "gold"
|
84
84
|
got: "silver"
|
85
|
-
|
85
|
+
|
86
86
|
# ./spec/user_api_spec.rb:26:in `block (2 levels) in <top (required)>'
|
87
87
|
|
88
88
|
Finished in 0.00102 seconds (files took 0.0853 seconds to load)
|
data/bin/build
CHANGED
@@ -44,7 +44,7 @@ Feature: RSpec matcher support for include_json matcher
|
|
44
44
|
1 example, 0 failures
|
45
45
|
"""
|
46
46
|
|
47
|
-
Scenario: Expecting
|
47
|
+
Scenario: Expecting json string to include simple json using an rspec alias matcher
|
48
48
|
Given a file "spec/matcher_example_spec.rb" with:
|
49
49
|
"""ruby
|
50
50
|
require "spec_helper"
|
@@ -9,39 +9,20 @@ module RSpec
|
|
9
9
|
RSpec::Matchers.define(@matcher_name) do |expected|
|
10
10
|
yield
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
traverse(expected, actual, false)
|
16
|
-
end
|
17
|
-
|
18
|
-
match_when_negated do |actual|
|
19
|
-
traverse(expected, actual, true)
|
20
|
-
end
|
21
|
-
|
22
|
-
failure_message do |actual|
|
23
|
-
RSpec::JsonExpectations::FailurePresenter.render(@include_json_errors)
|
24
|
-
end
|
25
|
-
|
26
|
-
failure_message_when_negated do |actual|
|
27
|
-
RSpec::JsonExpectations::FailurePresenter.render(@include_json_errors)
|
28
|
-
end
|
29
|
-
else
|
30
|
-
match_for_should do |actual|
|
31
|
-
traverse(expected, actual, false)
|
32
|
-
end
|
12
|
+
match do |actual|
|
13
|
+
traverse(expected, actual, false)
|
14
|
+
end
|
33
15
|
|
34
|
-
|
35
|
-
|
36
|
-
|
16
|
+
match_when_negated do |actual|
|
17
|
+
traverse(expected, actual, true)
|
18
|
+
end
|
37
19
|
|
38
|
-
|
39
|
-
|
40
|
-
|
20
|
+
failure_message do |actual|
|
21
|
+
RSpec::JsonExpectations::FailurePresenter.render(@include_json_errors)
|
22
|
+
end
|
41
23
|
|
42
|
-
|
43
|
-
|
44
|
-
end
|
24
|
+
failure_message_when_negated do |actual|
|
25
|
+
RSpec::JsonExpectations::FailurePresenter.render(@include_json_errors)
|
45
26
|
end
|
46
27
|
end
|
47
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-json_expectations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleksii Fedorov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.6.10
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Set of matchers and helpers to allow you test your APIs responses like a
|