mismatch-inspectable 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 671248717fed7d33e53f9e167f8e58d7344189fc8f2a77ab2b4fbcad603db188
4
+ data.tar.gz: 3c45218dd7adbbde45baddfa827ee71de4f2781d1e50aa44ce465567eca98f92
5
+ SHA512:
6
+ metadata.gz: 365ef02e25f9e3d697d887ddab05c9fb14aeedaf9190a57d9ca2c6e197dcfeed5276c7e6d77f4282893aa5ca380035b6e967f43daf9899b451ca7ae3e8b5668c
7
+ data.tar.gz: eefe5088fdfc55365c237f5b5fa84472b50352b61a21f7f88302e7bf156f52f4d40b9021da44cb93d152a3918d57ecf262781b77f39c093a3d15490864dcf8a9
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Tyler Rhodes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,17 @@
1
+ module MismatchInspectable
2
+ class ArrayFormatter
3
+ attr_reader :mismatches
4
+
5
+ def initialize
6
+ @mismatches = []
7
+ end
8
+
9
+ def add_mismatch(prefix, attribute, curr_val, other_val)
10
+ @mismatches << [prefix + attribute.to_s, curr_val, other_val]
11
+ end
12
+
13
+ def merge_mismatches(nested_mismatches)
14
+ @mismatches.concat(nested_mismatches)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module DeepMerge
2
+ def deep_merge!(other_hash)
3
+ other_hash&.each do |key, value|
4
+ if self[key].is_a?(Hash) && value.is_a?(Hash)
5
+ self[key].extend(DeepMerge) unless self[key].respond_to?(:deep_merge!)
6
+ self[key].deep_merge!(value)
7
+ else
8
+ self[key] = value
9
+ end
10
+ end
11
+ self
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ module MismatchInspectable
2
+ class HashFormatter
3
+ attr_reader :mismatches
4
+
5
+ def initialize
6
+ @mismatches = Hash.new { |hash, key| hash[key] = {} }
7
+ end
8
+
9
+ def add_mismatch(prefix, attribute, curr_val, other_val)
10
+ @mismatches[prefix + attribute.to_s] = [curr_val, other_val]
11
+ end
12
+
13
+ def merge_mismatches(nested_mismatches)
14
+ nested_mismatches.each { |k, v| mismatches[k] = v }
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,79 @@
1
+ require_relative 'hash_formatter'
2
+ require_relative 'array_formatter'
3
+ require_relative 'object_formatter'
4
+
5
+ module MismatchInspectable
6
+ class << self
7
+ def included(base)
8
+ class << base
9
+ include ClassMethods
10
+ end
11
+ end
12
+ end
13
+
14
+ module ClassMethods
15
+ attr_reader :compare_methods
16
+
17
+ def inspect_mismatch_for(*methods)
18
+ @compare_methods = methods
19
+ end
20
+ end
21
+
22
+ def inspect_mismatch(other, recursive: false, include_class: true, prefix: '', format: :array)
23
+ return if self.class != other.class
24
+
25
+ formatter = case format
26
+ when :hash then HashFormatter.new
27
+ when :array then ArrayFormatter.new
28
+ when :object then ObjectFormatter.new
29
+ else raise ArgumentError, "Invalid format: #{format}"
30
+ end
31
+
32
+ process_attributes(formatter, other, recursive, include_class, prefix, format)
33
+ formatter.mismatches
34
+ end
35
+
36
+ def compare_methods
37
+ self.class.compare_methods
38
+ end
39
+
40
+ private
41
+
42
+ def process_attributes(formatter, other, recursive, include_class, prefix, format)
43
+ self.class.compare_methods.each do |attribute|
44
+ curr_val = __send__(attribute)
45
+ other_val = other.__send__(attribute)
46
+
47
+ if recursive && both_are_inspectable?(curr_val, other_val)
48
+ process_recursive(formatter, curr_val, other_val, include_class, prefix, attribute, format)
49
+ elsif curr_val != other_val
50
+ prefix = update_prefix(include_class, prefix)
51
+ formatter.add_mismatch(prefix, attribute, curr_val, other_val)
52
+ end
53
+ end
54
+ end
55
+
56
+ def both_are_inspectable?(curr_val, other_val)
57
+ curr_val.respond_to?(:inspect_mismatch) && other_val.respond_to?(:inspect_mismatch)
58
+ end
59
+
60
+ def process_recursive(formatter, curr_val, other_val, include_class, prefix, attribute, format)
61
+ nested_mismatches = curr_val.inspect_mismatch(
62
+ other_val,
63
+ recursive: true,
64
+ include_class: include_class,
65
+ prefix: prefix + "#{attribute}.",
66
+ format: format
67
+ )
68
+
69
+ formatter.merge_mismatches(nested_mismatches) unless nested_mismatches?(nested_mismatches)
70
+ end
71
+
72
+ def update_prefix(include_class, prefix)
73
+ include_class ? "#{prefix}#{self.class}#" : prefix
74
+ end
75
+
76
+ def nested_mismatches?(mismatches)
77
+ mismatches.nil? || mismatches.empty?
78
+ end
79
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'deep_merge'
2
+
3
+ class ObjectFormatter
4
+ def initialize
5
+ @mismatches = {}.extend(DeepMerge)
6
+ end
7
+
8
+ attr_reader :mismatches
9
+
10
+ def add_mismatch(prefix, attribute, curr_val, other_val)
11
+ prefix_parts = prefix.split('.').flat_map { |part| part.split('#') }.collect(&:to_sym)
12
+ curr = mismatches
13
+
14
+ prefix_parts.each do |part|
15
+ curr[part] ||= {}
16
+ curr = curr[part]
17
+ end
18
+
19
+ curr[attribute] = [curr_val, other_val]
20
+ end
21
+
22
+ def merge_mismatches(nested_mismatches)
23
+ mismatches.deep_merge!(nested_mismatches)
24
+ end
25
+ end
@@ -0,0 +1 @@
1
+ require_relative 'mismatch_inspectable/mismatch_inspectable'
data/spec/examples.txt ADDED
@@ -0,0 +1,22 @@
1
+ example_id | status | run_time |
2
+ ---------------------------------------------------------- | ------ | --------------- |
3
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:1:1] | passed | 0.0009 seconds |
4
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:1:1] | passed | 0.00075 seconds |
5
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:1:2:1] | passed | 0.00015 seconds |
6
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:1:3:1:1:1] | passed | 0.0002 seconds |
7
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:1:3:1:1:2:1] | passed | 0.00016 seconds |
8
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:1:3:1:2:1] | passed | 0.00015 seconds |
9
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:1:3:1:2:2:1] | passed | 0.00016 seconds |
10
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:1:3:2:1] | passed | 0.00013 seconds |
11
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:1:1] | passed | 0.00011 seconds |
12
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:2:1] | passed | 0.00072 seconds |
13
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:3:1] | passed | 0.00036 seconds |
14
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:4:1:1:1:1] | passed | 0.00023 seconds |
15
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:4:1:1:2:1] | passed | 0.00018 seconds |
16
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:4:1:1:3:1] | passed | 0.00015 seconds |
17
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:4:1:2:1:1] | passed | 0.00023 seconds |
18
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:4:1:2:2:1] | passed | 0.00026 seconds |
19
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:4:1:2:3:1] | passed | 0.00061 seconds |
20
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:4:2:1:1] | passed | 0.00016 seconds |
21
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:4:2:2:1] | passed | 0.00034 seconds |
22
+ ./spec/lib/mismatch_inspectable_spec.rb[1:1:2:2:4:2:3:1] | passed | 0.00025 seconds |
@@ -0,0 +1,313 @@
1
+ require 'rspec'
2
+ require 'spec_helper'
3
+ require 'mismatch_inspectable/mismatch_inspectable'
4
+
5
+ class TestClass
6
+ include MismatchInspectable
7
+
8
+ attr_accessor :name, :age, :address, :nested
9
+
10
+ inspect_mismatch_for :name, :age, :address, :nested
11
+ end
12
+
13
+ class NestedTestClass
14
+ include MismatchInspectable
15
+
16
+ attr_accessor :city, :country
17
+
18
+ inspect_mismatch_for :city, :country
19
+ end
20
+
21
+ RSpec.describe MismatchInspectable do
22
+ let(:object1) { TestClass.new }
23
+ let(:object2) { TestClass.new }
24
+ let(:format) { :array }
25
+ let(:recursive) { false }
26
+
27
+ let(:name) { 'Tyler' }
28
+ let(:age) { 29 }
29
+ let(:address) { '123 Cool St' }
30
+
31
+ before do
32
+ object1.name = name
33
+ object1.age = age
34
+ object1.address = address
35
+
36
+ object2.name = name
37
+ object2.age = age
38
+ object2.address = address
39
+ end
40
+
41
+ describe '#inspect_mismatch' do
42
+ context 'when objects are of different classes' do
43
+ let(:object3) { Object.new }
44
+
45
+ it 'returns nil' do
46
+ expect(object1.inspect_mismatch(object3)).to be_nil
47
+ end
48
+ end
49
+
50
+ context 'when objects are of the same class' do
51
+ context 'with top level attributes that match' do
52
+ it 'returns an empty array' do
53
+ expect(object1.inspect_mismatch(object1)).to eq([])
54
+ end
55
+
56
+ context 'when format is set to :hash' do
57
+ let(:format) { :hash }
58
+
59
+ it 'returns an empty hash' do
60
+ expect(object1.inspect_mismatch(object1, format: format)).to eq({})
61
+ end
62
+ end
63
+
64
+ context 'with nested inspectable attributes' do
65
+ let(:recursive) { true }
66
+
67
+ context 'when objects have nested attributes with the same class' do
68
+ let(:nested1) { NestedTestClass.new }
69
+ let(:nested2) { NestedTestClass.new }
70
+
71
+ let(:city) { 'ATX' }
72
+ let(:country) { 'USA' }
73
+
74
+ before do
75
+ nested1.city = city
76
+ nested1.country = country
77
+
78
+ nested2.city = city
79
+ nested2.country = country
80
+
81
+ object1.nested = nested1
82
+ object2.nested = nested2
83
+ end
84
+
85
+ context 'when nested attributes match' do
86
+ it 'returns an empty array' do
87
+ expect(object1.inspect_mismatch(object2, recursive: recursive)).to eq([])
88
+ end
89
+
90
+ context 'when format is set to :hash' do
91
+ let(:format) { :hash }
92
+ it 'returns an empty hash' do
93
+ expect(object1.inspect_mismatch(object2, format: format, recursive: recursive)).to eq({})
94
+ end
95
+ end
96
+ end
97
+
98
+ context 'when nested attributes have different values' do
99
+ before { nested2.city = 'Phoenix' }
100
+
101
+ it 'returns an array of mismatched nested attributes with recursive flag enabled' do
102
+ expected = [
103
+ ['nested.NestedTestClass#city', 'ATX', 'Phoenix']
104
+ ]
105
+ expect(object1.inspect_mismatch(object2, recursive: recursive)).to eq(expected)
106
+ end
107
+
108
+ context 'when format is set to :hash' do
109
+ let(:format) { :hash }
110
+ it 'returns a hash of mismatched nested attributes with recursive flag enabled' do
111
+ expected = {
112
+ 'nested.NestedTestClass#city' => %w[ATX Phoenix]
113
+ }
114
+ expect(object1.inspect_mismatch(object2, format: format, recursive: recursive)).to eq(expected)
115
+ end
116
+ end
117
+ end
118
+ end
119
+
120
+ context 'when nested attributes have different classes' do
121
+ let(:nested1) { NestedTestClass.new }
122
+ let(:nested2) { TestClass.new }
123
+
124
+ before do
125
+ object1.nested = nested1
126
+ object2.nested = nested2
127
+ end
128
+
129
+ it 'returns nil for mismatched nested attribute with recursive flag enabled' do
130
+ expect(object1.inspect_mismatch(object2, recursive: recursive)).to eq([])
131
+ end
132
+ end
133
+ end
134
+ end
135
+
136
+ context "with top level attributes that don't match" do
137
+ before { object2.age = 30 }
138
+
139
+ context 'when format is set to :array (default)' do
140
+ it 'returns an array of mismatched attributes' do
141
+ expected = [
142
+ ['TestClass#age', 29, 30]
143
+ ]
144
+ expect(object1.inspect_mismatch(object2)).to eq(expected)
145
+ end
146
+ end
147
+
148
+ context 'when format is set to :hash' do
149
+ let(:format) { :hash }
150
+ it 'returns a hash of mismatched attributes' do
151
+ expected = {
152
+ 'TestClass#age' => [29, 30]
153
+ }
154
+ expect(object1.inspect_mismatch(object2, format: format)).to eq(expected)
155
+ end
156
+ end
157
+
158
+ context 'when format is set to :object' do
159
+ let(:format) { :object }
160
+ it 'returns an object of mismatched attributes' do
161
+ expected = {
162
+ TestClass: {
163
+ age: [29, 30]
164
+ }
165
+ }
166
+ expect(object1.inspect_mismatch(object2, format: format)).to eq(expected)
167
+ end
168
+ end
169
+
170
+ context 'with nested inspectable attributes' do
171
+ let(:recursive) { true }
172
+ context 'when objects have nested attributes with the same class' do
173
+ let(:nested1) { NestedTestClass.new }
174
+ let(:nested2) { NestedTestClass.new }
175
+
176
+ let(:city) { 'ATX' }
177
+ let(:country) { 'USA' }
178
+
179
+ before do
180
+ nested1.city = city
181
+ nested1.country = country
182
+
183
+ nested2.city = 'Phoenix'
184
+ nested2.country = country
185
+
186
+ object1.nested = nested1
187
+ object2.nested = nested1
188
+ end
189
+
190
+ context 'when nested attributes match' do
191
+ context 'when format is set to :array (default)' do
192
+ it 'returns the top-level mismatched attributes' do
193
+ expected = [
194
+ ['TestClass#age', 29, 30]
195
+ ]
196
+ expect(object1.inspect_mismatch(object2)).to eq(expected)
197
+ end
198
+ end
199
+
200
+ context 'when format is set to :hash' do
201
+ let(:format) { :hash }
202
+ it 'returns the top-level mismatched attributes' do
203
+ expected = {
204
+ 'TestClass#age' => [29, 30]
205
+ }
206
+ expect(object1.inspect_mismatch(object2, format: format)).to eq(expected)
207
+ end
208
+ end
209
+
210
+ context 'when format is set to :object' do
211
+ let(:format) { :object }
212
+ it 'returns the top-level mismatched attributes' do
213
+ expected = {
214
+ TestClass: {
215
+ age: [29, 30]
216
+ }
217
+ }
218
+ expect(object1.inspect_mismatch(object2, format: format)).to eq(expected)
219
+ end
220
+ end
221
+ end
222
+
223
+ context 'when nested attributes have different values' do
224
+ before { object2.nested = nested2 }
225
+
226
+ context 'when format is set to :array (default)' do
227
+ it 'returns an array of mismatched nested attributes with recursive flag enabled' do
228
+ expected = [
229
+ ['TestClass#age', 29, 30],
230
+ ['TestClass#nested.NestedTestClass#city', 'ATX', 'Phoenix']
231
+ ]
232
+ expect(object1.inspect_mismatch(object2, recursive: true)).to eq(expected)
233
+ end
234
+ end
235
+
236
+ context 'when format is set to :hash' do
237
+ let(:format) { :hash }
238
+ it 'returns a hash of mismatched nested attributes with recursive flag enabled' do
239
+ expected = {
240
+ 'TestClass#age' => [29, 30],
241
+ 'TestClass#nested.NestedTestClass#city' => %w[ATX Phoenix]
242
+ }
243
+ expect(object1.inspect_mismatch(object2, recursive: recursive, format: format)).to eq(expected)
244
+ end
245
+ end
246
+
247
+ context 'when format is set to :object' do
248
+ let(:format) { :object }
249
+ it 'returns an object of mismatched nested attributes with recursive flag enabled' do
250
+ expected = {
251
+ TestClass: {
252
+ age: [29, 30],
253
+ nested: {
254
+ NestedTestClass: {
255
+ city: %w[ATX Phoenix]
256
+ }
257
+ }
258
+ }
259
+ }
260
+ expect(object1.inspect_mismatch(object2, recursive: recursive, format: format)).to eq(expected)
261
+ end
262
+ end
263
+ end
264
+ end
265
+
266
+ context 'when nested attributes have different classes' do
267
+ let(:nested1) { NestedTestClass.new }
268
+ let(:nested2) { TestClass.new }
269
+
270
+ before do
271
+ object1.nested = nested1
272
+ object2.nested = nested2
273
+ end
274
+
275
+ context 'when format is set to :array (default)' do
276
+ it 'returns nil for mismatched nested attribute with recursive flag enabled' do
277
+ expect(object1.inspect_mismatch(object2, recursive: recursive)).to eq(
278
+ [
279
+ ['TestClass#age', 29, 30]
280
+ ]
281
+ )
282
+ end
283
+ end
284
+
285
+ context 'when format is set to :hash' do
286
+ let(:format) { :hash }
287
+ it 'returns nil for mismatched nested attribute with recursive flag enabled' do
288
+ expect(object1.inspect_mismatch(object2, recursive: recursive, format: format)).to eq(
289
+ {
290
+ 'TestClass#age' => [29, 30]
291
+ }
292
+ )
293
+ end
294
+ end
295
+
296
+ context 'when format is set to :object' do
297
+ let(:format) { :object }
298
+ it 'returns nil for mismatched nested attribute with recursive flag enabled' do
299
+ expect(object1.inspect_mismatch(object2, recursive: recursive, format: format)).to eq(
300
+ {
301
+ TestClass: {
302
+ age: [29, 30]
303
+ }
304
+ }
305
+ )
306
+ end
307
+ end
308
+ end
309
+ end
310
+ end
311
+ end
312
+ end
313
+ end
@@ -0,0 +1,98 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ # # This allows you to limit a spec run to individual examples or groups
50
+ # # you care about by tagging them with `:focus` metadata. When nothing
51
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
52
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
53
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
54
+ # config.filter_run_when_matching :focus
55
+ #
56
+ # # Allows RSpec to persist some state between runs in order to support
57
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
58
+ # # you configure your source control system to ignore this file.
59
+ config.example_status_persistence_file_path = 'spec/examples.txt'
60
+ #
61
+ # # Limits the available syntax to the non-monkey patched syntax that is
62
+ # # recommended. For more details, see:
63
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
64
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
65
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
66
+ # config.disable_monkey_patching!
67
+ #
68
+ # # This setting enables warnings. It's recommended, but in some cases may
69
+ # # be too noisy due to issues in dependencies.
70
+ # config.warnings = true
71
+ #
72
+ # # Many RSpec users commonly either run the entire suite or an individual
73
+ # # file, and it's useful to allow more verbose output when running an
74
+ # # individual spec file.
75
+ # if config.files_to_run.one?
76
+ # # Use the documentation formatter for detailed output,
77
+ # # unless a formatter has already been configured
78
+ # # (e.g. via a command-line flag).
79
+ # config.default_formatter = "doc"
80
+ # end
81
+ #
82
+ # # Print the 10 slowest examples and example groups at the
83
+ # # end of the spec run, to help surface which specs are running
84
+ # # particularly slow.
85
+ # config.profile_examples = 10
86
+ #
87
+ # # Run specs in random order to surface order dependencies. If you find an
88
+ # # order dependency and want to debug it, you can fix the order by providing
89
+ # # the seed, which is printed after each run.
90
+ # # --seed 1234
91
+ # config.order = :random
92
+ #
93
+ # # Seed global randomization in this process using the `--seed` CLI option.
94
+ # # Setting this allows you to use `--seed` to deterministically reproduce
95
+ # # test failures related to randomization by passing the same `--seed` value
96
+ # # as the one that triggered the failure.
97
+ # Kernel.srand config.seed
98
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mismatch-inspectable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tyler Rhodes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-03-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: A library that includes a module that can print mismatched values for
28
+ any class that includes it. Supports recursive inspection of nested objects.
29
+ email:
30
+ - tyler.rhodes@aya.yale.edu
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - LICENSE.md
36
+ - lib/mismatch_inspectable.rb
37
+ - lib/mismatch_inspectable/array_formatter.rb
38
+ - lib/mismatch_inspectable/deep_merge.rb
39
+ - lib/mismatch_inspectable/hash_formatter.rb
40
+ - lib/mismatch_inspectable/mismatch_inspectable.rb
41
+ - lib/mismatch_inspectable/object_formatter.rb
42
+ - spec/examples.txt
43
+ - spec/lib/mismatch_inspectable_spec.rb
44
+ - spec/spec_helper.rb
45
+ homepage: https://github.com/tyleCaineRhodes/mismatch-inspectable
46
+ licenses:
47
+ - MIT
48
+ metadata: {}
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubygems_version: 3.2.3
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: A library for easily printing and debugging mismatched values
68
+ test_files:
69
+ - spec/examples.txt
70
+ - spec/lib/mismatch_inspectable_spec.rb
71
+ - spec/spec_helper.rb