json_spec 1.1.2 → 1.1.3

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: cb0b1f7ab27245791f7d65778506309a14a43645
4
- data.tar.gz: 3aa7d4931332e3ffe04d7d44da3d8256b7fa613f
3
+ metadata.gz: 98cdb5ce2f62a93c0ba56565fceea1f93a7d1d1e
4
+ data.tar.gz: 149b6060bc8514bcd6ad856e7ef748d622414f0b
5
5
  SHA512:
6
- metadata.gz: ed9cb913d6d387841c2f7a725b4aaf192cf3a4aa72dad6e052f155574cdb563232ecb8f1d780d1a2636a324c6c8ea42cb7e9f4a15f0ffeb601ed294a6c19da7a
7
- data.tar.gz: 3fba85ecb36f7d03cb4f04a661622f43b51764ec04ae9f3b6312c8f67bd54084cbbb9f6563c0121f1eb30a4ed85fedcf70d52140b64d6015498ee06b7c0bda84
6
+ metadata.gz: 0c6d9cad2a54c5485f142bc581a789d495542e7a4fee7ed385c6e1e147ec0a374486f673718e8dfeb1ad1feccb471ea09247c1500a8bb0907ac76d617d9be0d0
7
+ data.tar.gz: c4c4b16b051f2af4fe1e09151c6c6bbcd26c6f348db1ee3ccf06c784fbac9970708deec2b8386ce2ab63d3711621188d5d6a08f7a5a0a61b64f92d450f7932ee
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "json_spec"
5
- gem.version = "1.1.2"
5
+ gem.version = "1.1.3"
6
6
 
7
7
  gem.authors = ["Steve Richert"]
8
8
  gem.email = ["steve.richert@gmail.com"]
@@ -12,6 +12,8 @@ module JsonSpec
12
12
  def matches?(actual_json)
13
13
  raise "Expected included JSON not provided" if @expected_json.nil?
14
14
 
15
+ @actual_json = actual_json
16
+
15
17
  actual = parse_json(actual_json, @path)
16
18
  expected = exclude_keys(parse_json(@expected_json))
17
19
  case actual
@@ -43,12 +45,12 @@ module JsonSpec
43
45
  end
44
46
 
45
47
  def failure_message
46
- message_with_path("Expected included JSON")
48
+ message_with_path("Expected #{@actual_json} to include #{@expected_json}")
47
49
  end
48
50
  alias :failure_message_for_should :failure_message
49
51
 
50
52
  def failure_message_when_negated
51
- message_with_path("Expected excluded JSON")
53
+ message_with_path("Expected #{@actual_json} to not include #{@expected_json}")
52
54
  end
53
55
  alias :failure_message_for_should_not :failure_message_when_negated
54
56
 
@@ -71,6 +71,18 @@ describe JsonSpec::Matchers::IncludeJson do
71
71
  matcher.description.should == %(include JSON at path "json/0")
72
72
  end
73
73
 
74
+ it "provides a useful failure message for should" do
75
+ matcher = include_json(%([4,5,6]))
76
+ matcher.matches?(%([1,2,3]))
77
+ matcher.failure_message_for_should.should == "Expected [1,2,3] to include [4,5,6]"
78
+ end
79
+
80
+ it "provides a useful failure message for should not" do
81
+ matcher = include_json(%(3))
82
+ matcher.matches?(%([1,2,3]))
83
+ matcher.failure_message_for_should_not.should == "Expected [1,2,3] to not include 3"
84
+ end
85
+
74
86
  it "raises an error when not given expected JSON" do
75
87
  expect{ %([{"id":1,"two":3}]).should include_json }.to raise_error
76
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Richert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-17 00:00:00.000000000 Z
11
+ date: 2014-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json