rspec-json_expectations 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzYyYWJmZmM2MjVhYWIyMTc4NWM3MjQwOWQxMGI3MjhmNjczZDEzMA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZmNmZjk1YTczOTFmMjkxOTlhMmNkYTc3YjJhNjNkMTQ5NWQ0NjU2Mw==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MTllMTU1OTA4ODg0MTVlNGQ0MjA2OWU1OGQyMzM2ZjFhYjk5Yzk2ZTEwYjJk
|
10
|
+
ODVkZjg0MjdmYTQ5YTAyYzBjYzI2Mjc1YjJlZmJmY2JlMWVkZDI4MTEzNTFm
|
11
|
+
MWM1ZTc4Zjk2Y2I4OTllMzdlMzFmODEzOGY1MDZkODZmNGZiMzA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTQ0ZjExYTI0MTk4NjExNDg2MmU5YTg1ZTI2OGU4NGZjNzQ5MzI3MTU0OGQx
|
14
|
+
ZDc3M2M0ODI1MWE4YmU5ZTc5YzBjNzVmYmQ5MzA0MTU1ODg4ZjJkYTNjNDhl
|
15
|
+
MDYyODcxNmY5NWFjYmRlMjFkYjkyNDg2N2NmN2JkMzVhZWVlZTk=
|
data/.travis.yml
CHANGED
@@ -1,9 +1,18 @@
|
|
1
|
-
|
1
|
+
dist: trusty
|
2
2
|
language: ruby
|
3
|
+
|
3
4
|
rvm:
|
4
5
|
- 1.9.3
|
5
6
|
- 2.0.0
|
6
|
-
- 2.1
|
7
|
+
- 2.1
|
8
|
+
- 2.2
|
9
|
+
- "ruby-2.3.0"
|
10
|
+
|
7
11
|
gemfile:
|
8
12
|
- gemfiles/rspec-2
|
9
13
|
- gemfiles/rspec-3
|
14
|
+
|
15
|
+
before_install:
|
16
|
+
- gem install bundler
|
17
|
+
|
18
|
+
script: bundle exec cucumber
|
@@ -28,6 +28,37 @@ Feature: regular expressions support with include_json matcher
|
|
28
28
|
"url": "https://test.example.org/api/v6/users/5wmsx6ae7p.json"
|
29
29
|
}
|
30
30
|
"""
|
31
|
+
And a local "COMPLEX_JSON" with:
|
32
|
+
"""json
|
33
|
+
{
|
34
|
+
"balance": 25.0,
|
35
|
+
"status": true,
|
36
|
+
"avatar_url": null
|
37
|
+
}
|
38
|
+
"""
|
39
|
+
|
40
|
+
Scenario: Expecting json string to include typed json with regex
|
41
|
+
Given a file "spec/simple_example_spec.rb" with:
|
42
|
+
"""ruby
|
43
|
+
require "spec_helper"
|
44
|
+
|
45
|
+
RSpec.describe "A json response" do
|
46
|
+
subject { '%{COMPLEX_JSON}' }
|
47
|
+
|
48
|
+
it "has basic info about user" do
|
49
|
+
expect(subject).to include_json(
|
50
|
+
balance: /\d/,
|
51
|
+
status: /true|false/,
|
52
|
+
avatar_url: /^?/
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
"""
|
57
|
+
When I run "rspec spec/simple_example_spec.rb"
|
58
|
+
Then I see:
|
59
|
+
"""
|
60
|
+
1 example, 0 failures
|
61
|
+
"""
|
31
62
|
|
32
63
|
Scenario: Expecting json string to include simple json with regex
|
33
64
|
Given a file "spec/simple_example_spec.rb" with:
|
@@ -71,7 +71,7 @@ module RSpec
|
|
71
71
|
def handle_regex(errors, expected, actual, negate=false, prefix=[])
|
72
72
|
return nil unless expected.is_a?(Regexp)
|
73
73
|
|
74
|
-
if conditionally_negate(!!expected.match(actual), negate)
|
74
|
+
if conditionally_negate(!!expected.match(actual.to_s), negate)
|
75
75
|
true
|
76
76
|
else
|
77
77
|
errors[prefix.join("/")] = {
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-json_expectations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Fedorov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: ''
|
@@ -48,8 +48,8 @@ executables:
|
|
48
48
|
extensions: []
|
49
49
|
extra_rdoc_files: []
|
50
50
|
files:
|
51
|
-
-
|
52
|
-
-
|
51
|
+
- .gitignore
|
52
|
+
- .travis.yml
|
53
53
|
- LICENSE.txt
|
54
54
|
- README.md
|
55
55
|
- Rakefile
|
@@ -84,17 +84,17 @@ require_paths:
|
|
84
84
|
- lib
|
85
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- -
|
92
|
+
- - ! '>='
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.5.1
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Set of matchers and helpers to allow you test your APIs responses like a
|
@@ -109,4 +109,3 @@ test_files:
|
|
109
109
|
- features/rspec/json_expectations/simple_hash_match.feature
|
110
110
|
- features/step_definitions/steps.rb
|
111
111
|
- features/support/env.rb
|
112
|
-
has_rdoc:
|