diff_matcher 2.4.1 → 2.5.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/diff_matcher.gemspec +1 -0
- data/lib/diff_matcher/rspec.rb +3 -0
- data/lib/diff_matcher/rspec/matchers/diff_matcher.rb +31 -0
- data/lib/diff_matcher/version.rb +1 -1
- data/spec/diff_matcher/rspec/matchers/diff_matcher_spec.rb +12 -0
- metadata +9 -4
- data/License.txt +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2868c9df6fcb0629a3b11aa0ff612fec55d83c7e
|
4
|
+
data.tar.gz: db68ce3ce7834da9517bea0b7987537f3cbb3e85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57f3e4075c94f1ebf5f4ce3862df3c7ee6e32a39ee27eba9f37f65cd6d377686dfda4bcd8a62ae2a0379ad9780c11555dabc43e0e9faa03ea4aa190779c67c3f
|
7
|
+
data.tar.gz: 0f5752354f037eed868ccf50fab9c0e84c6593cb710effa098555c73aadc89327bd110cd30d5c2e64360dcf3a42020ab0ab985ae7633306f08a845e6ae30cc00
|
data/CHANGELOG.md
CHANGED
data/diff_matcher.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.authors = ["locochris"]
|
11
11
|
s.email = "chris@locomote.com.au"
|
12
12
|
s.homepage = "http://github.com/diff-matcher/diff_matcher"
|
13
|
+
s.licenses = %w{ BSD MIT }
|
13
14
|
|
14
15
|
s.summary = %q{Generates a diff by matching against user-defined matchers written in ruby.}
|
15
16
|
s.description = <<EOF
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Uses the diff_matcher gem to provide advanced matching abilities, along with nice visual representation of the
|
2
|
+
# diff between actual and expected. The functionality set is very helpful for comparing hashes.
|
3
|
+
#
|
4
|
+
# Usage examples:
|
5
|
+
# it { should be_matching(my_var) }
|
6
|
+
# it { should be_matching(my_var).with_options(ignore_additional: true) }
|
7
|
+
#
|
8
|
+
# Options: by default, color_enabled is controlled by Rspec, and quiet is set to true.
|
9
|
+
RSpec::Matchers.define :be_matching do |expected|
|
10
|
+
match do |actual|
|
11
|
+
options = { :color_enabled => RSpec::configuration.color_enabled?, :quiet => true }.merge(@options || {})
|
12
|
+
@difference = DiffMatcher::Difference.new(expected, actual, options)
|
13
|
+
@difference.matching?
|
14
|
+
end
|
15
|
+
|
16
|
+
chain :with_options do |options|
|
17
|
+
@options = options
|
18
|
+
end
|
19
|
+
|
20
|
+
failure_message_for_should do |actual|
|
21
|
+
"diff is:\n" + @difference.to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
failure_message_for_should_not do |actual|
|
25
|
+
"diff is:\n" + @difference.to_s
|
26
|
+
end
|
27
|
+
|
28
|
+
description do
|
29
|
+
"match via DiffMatcher #{expected}" + (@options.blank? ? '' : " with options: #{@options}")
|
30
|
+
end
|
31
|
+
end
|
data/lib/diff_matcher/version.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'diff_matcher/rspec'
|
3
|
+
|
4
|
+
describe :be_matching do
|
5
|
+
it "should call DiffMatcher::Difference" do
|
6
|
+
DiffMatcher::Difference.should_receive(:new).with(
|
7
|
+
:expected, :actual, { :color_enabled => RSpec::configuration.color_enabled?, :quiet => true }.merge({ :foo => 'bar' })
|
8
|
+
).and_return(double(:matching? => true))
|
9
|
+
|
10
|
+
:actual.should be_matching(:expected).with_options :foo => 'bar'
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diff_matcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- locochris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
DiffMatcher matches input data (eg. from a JSON API) against values,
|
@@ -24,7 +24,6 @@ files:
|
|
24
24
|
- .travis.yml
|
25
25
|
- CHANGELOG.md
|
26
26
|
- Gemfile
|
27
|
-
- License.txt
|
28
27
|
- README.md
|
29
28
|
- Rakefile
|
30
29
|
- TODO.txt
|
@@ -34,11 +33,16 @@ files:
|
|
34
33
|
- lib/diff_matcher.rb
|
35
34
|
- lib/diff_matcher/difference.rb
|
36
35
|
- lib/diff_matcher/escape_to_html.rb
|
36
|
+
- lib/diff_matcher/rspec.rb
|
37
|
+
- lib/diff_matcher/rspec/matchers/diff_matcher.rb
|
37
38
|
- lib/diff_matcher/version.rb
|
38
39
|
- spec/diff_matcher/difference_spec.rb
|
40
|
+
- spec/diff_matcher/rspec/matchers/diff_matcher_spec.rb
|
39
41
|
- spec/spec_helper.rb
|
40
42
|
homepage: http://github.com/diff-matcher/diff_matcher
|
41
|
-
licenses:
|
43
|
+
licenses:
|
44
|
+
- BSD
|
45
|
+
- MIT
|
42
46
|
metadata: {}
|
43
47
|
post_install_message:
|
44
48
|
rdoc_options: []
|
@@ -62,4 +66,5 @@ specification_version: 4
|
|
62
66
|
summary: Generates a diff by matching against user-defined matchers written in ruby.
|
63
67
|
test_files:
|
64
68
|
- spec/diff_matcher/difference_spec.rb
|
69
|
+
- spec/diff_matcher/rspec/matchers/diff_matcher_spec.rb
|
65
70
|
- spec/spec_helper.rb
|
data/License.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
(The MIT License)
|
2
|
-
|
3
|
-
Copyright (c) 2011 PlayUp
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|