specdiff 0.2.0 → 0.3.0.pre.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0.pre.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Odin Heggvold Bekkelund
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-08 00:00:00.000000000 Z
11
+ date: 2024-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashdiff
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.5'
41
- description:
41
+ description:
42
42
  email:
43
43
  - odinhb@protonmail.com
44
44
  executables: []
@@ -54,6 +54,13 @@ files:
54
54
  - LICENSE.txt
55
55
  - README.md
56
56
  - Rakefile
57
+ - assets/webmock_json_with_specdiff.png
58
+ - assets/webmock_text_with_specdiff.png
59
+ - examples/rspec/.rspec
60
+ - examples/rspec/Gemfile
61
+ - examples/rspec/Gemfile.lock
62
+ - examples/rspec/spec/example_spec.rb
63
+ - examples/rspec/spec/spec_helper.rb
57
64
  - examples/webmock/Gemfile
58
65
  - examples/webmock/Gemfile.lock
59
66
  - examples/webmock/json.rb
@@ -68,12 +75,14 @@ files:
68
75
  - lib/specdiff/differ/hashdiff.rb
69
76
  - lib/specdiff/differ/not_found.rb
70
77
  - lib/specdiff/differ/text.rb
78
+ - lib/specdiff/hashprint.rb
79
+ - lib/specdiff/inspect.rb
71
80
  - lib/specdiff/plugin.rb
72
81
  - lib/specdiff/plugins.rb
73
82
  - lib/specdiff/plugins/json.rb
83
+ - lib/specdiff/rspec.rb
74
84
  - lib/specdiff/version.rb
75
85
  - lib/specdiff/webmock.rb
76
- - lib/specdiff/webmock/request_body_diff.rb
77
86
  - specdiff.gemspec
78
87
  homepage: https://github.com/odinhb/specdiff
79
88
  licenses:
@@ -82,7 +91,7 @@ metadata:
82
91
  homepage_uri: https://github.com/odinhb/specdiff
83
92
  source_code_uri: https://github.com/odinhb/specdiff
84
93
  changelog_uri: https://github.com/odinhb/specdiff/CHANGELOG.md
85
- post_install_message:
94
+ post_install_message:
86
95
  rdoc_options: []
87
96
  require_paths:
88
97
  - lib
@@ -93,12 +102,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
102
  version: 3.0.0
94
103
  required_rubygems_version: !ruby/object:Gem::Requirement
95
104
  requirements:
96
- - - ">="
105
+ - - ">"
97
106
  - !ruby/object:Gem::Version
98
- version: '0'
107
+ version: 1.3.1
99
108
  requirements: []
100
- rubygems_version: 3.4.10
101
- signing_key:
109
+ rubygems_version: 3.2.22
110
+ signing_key:
102
111
  specification_version: 4
103
112
  summary: Improved request body diffs for webmock
104
113
  test_files: []
@@ -1,41 +0,0 @@
1
- require "hashdiff"
2
- require "json"
3
-
4
- module WebMock
5
- class RequestBodyDiff
6
- def initialize(request_signature, request_stub)
7
- @request_signature = request_signature
8
- @request_stub = request_stub
9
- end
10
-
11
- PrettyPrintableThingy = Struct.new(:specdiff) do
12
- # webmock does not print the diff if it responds true to this.
13
- def empty?
14
- specdiff.empty?
15
- end
16
-
17
- # webmock prints the diff by passing us to PP.pp, which in turn uses this
18
- # method.
19
- def pretty_print(pp)
20
- pp.text("\r") # remove a space that isn't supposed to be there
21
- pp.text(specdiff.to_s)
22
- end
23
- end
24
-
25
- def body_diff
26
- specdiff = Specdiff.diff(request_stub_body, request_signature.body)
27
- PrettyPrintableThingy.new(specdiff)
28
- end
29
-
30
- attr_reader :request_signature, :request_stub
31
- private :request_signature, :request_stub
32
-
33
- private
34
-
35
- def request_stub_body
36
- request_stub.request_pattern &&
37
- request_stub.request_pattern.body_pattern &&
38
- request_stub.request_pattern.body_pattern.pattern
39
- end
40
- end
41
- end