rspec-raml 0.1.1 → 0.1.2

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: 6a6db8a35d8f744d098a9ab59a2e6eb60d2bcc7a
4
- data.tar.gz: 85f483ed670f830e4c2009691af1feb338c0c4f7
3
+ metadata.gz: 8ba735f8794e66e94088432feccc98f1862bbb43
4
+ data.tar.gz: e9865f89a7be1a54e3204af11e723a518b6569d2
5
5
  SHA512:
6
- metadata.gz: 1c74f9978ce417af1cce5bfc8ccd23591df7faf55dbc4554149290b2fb4e9648ac187e310532b084f244e90a580123341999fdfa182fc2c99adf0cce4c6842f9
7
- data.tar.gz: 34ed73307ce6dc4fbf3e87080c2421351bfb181ff0dc91f7d91a6019f20d7bafbb38c47bc84248663b55a85355e2017686d2d4ee8e328e50102f8927da8b77c5
6
+ metadata.gz: f149720d4648d75f0e719594a6ac6ebb2e25cf347531e49ddc1e64eef3b632fb013995bb9547180f29585d5d9e45847492bbaae9de0aaa5a3788246fb8db9a68
7
+ data.tar.gz: b0b14b47bdcaa2d7fa74540be7e7e1351198a40f660866629a39ec15f5f62a4b2b298e367f978aa9d9674dce03a3ca13e6e3c3f3f0f0d544767ec929b7dd2251
@@ -24,10 +24,6 @@ module RSpec
24
24
  def content_type
25
25
  response.content_type.to_s
26
26
  end
27
-
28
- def pretty_format(body)
29
- JSON.pretty_generate(JSON.parse(body))
30
- end
31
27
  end
32
28
  end
33
29
  end
@@ -5,7 +5,11 @@ module RSpec
5
5
  module Matchers
6
6
  class MatchRamlBody < Abstract
7
7
  def failure_message
8
- diff = differ.diff_as_string(response_body, raml_body)
8
+ diff = differ.diff_as_object(
9
+ response_body,
10
+ raml_body
11
+ )
12
+
9
13
  "expected response bodies to match:#{diff}"
10
14
  end
11
15
 
@@ -20,20 +24,16 @@ module RSpec
20
24
  end
21
25
 
22
26
  def response_body
23
- @response_body ||= indent_pretty_format(response.body)
27
+ @response_body ||= JSON.parse(response.body)
24
28
  end
25
29
 
26
30
  def raml_body
27
- @raml_body ||= indent_pretty_format(raml.bodies.fetch(content_type).example)
31
+ @raml_body ||= JSON.parse(raml.bodies.fetch(content_type).example)
28
32
  end
29
33
 
30
34
  def differ
31
35
  @differ ||= RSpec::Support::Differ.new(color: true)
32
36
  end
33
-
34
- def indent_pretty_format(body)
35
- pretty_format(body).gsub("\n", "\n ").prepend(' ')
36
- end
37
37
  end
38
38
  end
39
39
  end
@@ -37,6 +37,10 @@ module RSpec
37
37
  }
38
38
  }.deep_stringify_keys.to_yaml
39
39
  end
40
+
41
+ def pretty_format(body)
42
+ JSON.pretty_generate JSON.parse(body)
43
+ end
40
44
  end
41
45
  end
42
46
  end
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module Raml
3
- VERSION = "0.1.1"
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-raml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ray Zane
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-13 00:00:00.000000000 Z
11
+ date: 2016-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: raml_ruby