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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad526ab43a8b702954d8248d6b1edeb62b10b559
4
- data.tar.gz: 01aac3eeb128b3033ef51d03f7f1dde810f3824e
3
+ metadata.gz: 5d28854e379cee30a9d153b39e16f4d5e265699a
4
+ data.tar.gz: 6a27333ceba6c6662d71b9aebf8ab9e21254a8ca
5
5
  SHA512:
6
- metadata.gz: 44aec293d47aa8e184a6ec335531c4bc92e3c31dfae6d404bd5b8e956032540f8ad2b3c8191e0eebad6eddd3576118f2f2b8700fcb535a8ce472f265b6b4ab65
7
- data.tar.gz: 988b3ed14b8c35cc1fc9c58655ca3045765caac68a151bee15c73c0a85c3cf355252ef1f7ddf39a633de1fb5a581df5b26525bb324ae97d5ff5eea95b148c328
6
+ metadata.gz: cf7a7056e0adaebae13d1d8e6d1f958bafd0976294b3dbfed2c33c11d9f8fb4dd8b458d43d1170bcf2255c9a33b54a7792aa1579acc4aef48257692abb7a058a
7
+ data.tar.gz: 107150eb64c10d9313b2eacddf102fef5c0206b57eac067f64914da312977a10b9a0138eb3c8aa4261ef8449364b166fbea3ee8426ee3bfcdc09f3ea1545f119
@@ -5,11 +5,12 @@ rvm:
5
5
  - 2.1
6
6
  - 2.2
7
7
  - 2.3
8
+ - 2.4
8
9
 
9
10
  gemfile:
10
11
  - gemfiles/rspec-3
11
12
 
12
13
  before_install:
13
- - gem install bundler
14
+ - gem install bundler -v "~> 1.0"
14
15
 
15
16
  script: bundle exec cucumber
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 APIs responses like a pro.
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
@@ -1,3 +1,3 @@
1
1
  #!/bin/bash
2
2
 
3
- bin/with-rspec-2 install && bin/with-rspec-3 install && bin/with-rspec-2 exec cucumber && bin/with-rspec-3 exec cucumber && echo "SUCCESS" || echo "FAILED"
3
+ bin/with-rspec-3 install && bin/with-rspec-3 exec cucumber && echo "SUCCESS" || echo "FAILED"
@@ -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 jsong string to include simple json using an rspec alias matcher
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"
@@ -1,4 +1,5 @@
1
1
  require "rspec/core"
2
+ require "rspec/expectations"
2
3
  require "rspec/json_expectations/matcher_factory"
3
4
  require "rspec/json_expectations/version"
4
5
  require "rspec/json_expectations/json_traverser"
@@ -9,39 +9,20 @@ module RSpec
9
9
  RSpec::Matchers.define(@matcher_name) do |expected|
10
10
  yield
11
11
 
12
- # RSpec 2 vs 3
13
- if respond_to?(:failure_message)
14
- match do |actual|
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
- match_for_should_not do |actual|
35
- traverse(expected, actual, true)
36
- end
16
+ match_when_negated do |actual|
17
+ traverse(expected, actual, true)
18
+ end
37
19
 
38
- failure_message_for_should do |actual|
39
- RSpec::JsonExpectations::FailurePresenter.render(@include_json_errors)
40
- end
20
+ failure_message do |actual|
21
+ RSpec::JsonExpectations::FailurePresenter.render(@include_json_errors)
22
+ end
41
23
 
42
- failure_message_for_should_not do |actual|
43
- RSpec::JsonExpectations::FailurePresenter.render(@include_json_errors)
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
@@ -1,3 +1,5 @@
1
+ require "forwardable"
2
+
1
3
  RSpec::JsonExpectations::MatcherFactory.new(:include_json).define_matcher do
2
4
  def traverse(expected, actual, negate=false)
3
5
  unless expected.is_a?(Hash) ||
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module JsonExpectations
3
- VERSION = "2.1.0"
3
+ VERSION = "2.2.0"
4
4
  end
5
5
  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.1.0
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: 2017-01-07 00:00:00.000000000 Z
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.4.6
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