diff_matcher 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -5,8 +5,17 @@ rvm:
5
5
  - 1.9.2
6
6
  - 1.9.3
7
7
  - rbx
8
- # - rbx-19mode
8
+ - rbx-19mode
9
+ - rbx-2
9
10
  - jruby
10
11
  - ree
11
- # - ruby-head
12
12
  - 2.0.0
13
+ - 2.1.1
14
+ - ruby-head
15
+
16
+ matrix:
17
+ fast_finish: true
18
+ allow_failures:
19
+ - rvm: rbx
20
+ - rvm: rbx-19mode
21
+ - rvm: rbx-2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### v2.6.0
4
+
5
+ * Add rspec custom matcher `be_matching` for RSpec v3.x
6
+
3
7
  ### v2.5.0
4
8
 
5
9
  * Add rspec custom matcher `be_matching`
data/README.md CHANGED
@@ -355,42 +355,11 @@ do pattern matching and also looks like a good alternative to diff_matcher, it h
355
355
 
356
356
  Use with rspec
357
357
  ---
358
- To use with rspec, create a custom matcher. The following example matcher works with rspec-1.2.4 and up.
358
+ To use with rspec, require it in `spec_helper.rb`
359
359
 
360
360
  ``` ruby
361
- require 'diff_matcher'
362
-
363
- # Uses the diff_matcher gem to provide advanced matching abilities, along with nice visual representation of the
364
- # diff between actual and expected. The functionality set is very helpful for comparing hashes.
365
- #
366
- # Usage examples:
367
- # it { should be_matching(my_var) }
368
- # it { should be_matching(my_var).with_options(ignore_additional: true) }
369
- #
370
- # Options: by default, color_enabled is controlled by Rspec, and quiet is set to true.
371
- RSpec::Matchers.define :be_matching do |expected|
372
- match do |actual|
373
- options = { :color_enabled => RSpec::configuration.color_enabled?, :quiet => true }.merge(@options || {})
374
- @difference = DiffMatcher::Difference.new(expected, actual, options)
375
- @difference.matching?
376
- end
377
-
378
- chain :with_options do |options|
379
- @options = options
380
- end
381
-
382
- failure_message_for_should do |actual|
383
- "diff is:\n" + @difference.to_s
384
- end
385
-
386
- failure_message_for_should_not do |actual|
387
- "diff is:\n" + @difference.to_s
388
- end
389
-
390
- description do
391
- "match via DiffMatcher #{expected}" + (@options.blank? ? '' : " with options: #{@options}")
392
- end
393
- end
361
+ require 'diff_matcher/rspec' # for RSpec version < 3.0
362
+ require 'diff_matcher/rspec_3' # for RSpec version >= 3.x
394
363
  ```
395
364
 
396
365
  And use it with:
@@ -0,0 +1,3 @@
1
+ require 'rspec/core'
2
+ require 'diff_matcher'
3
+ require 'diff_matcher/rspec_3/matchers/diff_matcher'
@@ -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 do |actual|
21
+ "diff is:\n" + @difference.to_s
22
+ end
23
+
24
+ failure_message_when_negated 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
@@ -1,3 +1,3 @@
1
1
  module DiffMatcher
2
- VERSION = "2.5.0"
2
+ VERSION = "2.6.0"
3
3
  end
metadata CHANGED
@@ -1,19 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diff_matcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - locochris
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-07-29 00:00:00.000000000 Z
12
+ date: 2014-09-09 00:00:00.000000000 Z
12
13
  dependencies: []
13
- description: |
14
- DiffMatcher matches input data (eg. from a JSON API) against values,
14
+ description: ! 'DiffMatcher matches input data (eg. from a JSON API) against values,
15
+
15
16
  ranges, classes, regexes, procs, custom matchers and/or easily composed,
17
+
16
18
  nested combinations thereof to produce an easy to read diff string.
19
+
20
+ '
17
21
  email: chris@locomote.com.au
18
22
  executables: []
19
23
  extensions: []
@@ -35,6 +39,8 @@ files:
35
39
  - lib/diff_matcher/escape_to_html.rb
36
40
  - lib/diff_matcher/rspec.rb
37
41
  - lib/diff_matcher/rspec/matchers/diff_matcher.rb
42
+ - lib/diff_matcher/rspec_3.rb
43
+ - lib/diff_matcher/rspec_3/matchers/diff_matcher.rb
38
44
  - lib/diff_matcher/version.rb
39
45
  - spec/diff_matcher/difference_spec.rb
40
46
  - spec/diff_matcher/rspec/matchers/diff_matcher_spec.rb
@@ -43,26 +49,33 @@ homepage: http://github.com/diff-matcher/diff_matcher
43
49
  licenses:
44
50
  - BSD
45
51
  - MIT
46
- metadata: {}
47
52
  post_install_message:
48
53
  rdoc_options: []
49
54
  require_paths:
50
55
  - lib
51
56
  required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
- - - '>='
59
+ - - ! '>='
54
60
  - !ruby/object:Gem::Version
55
61
  version: '0'
62
+ segments:
63
+ - 0
64
+ hash: -213964590511459667
56
65
  required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
57
67
  requirements:
58
- - - '>='
68
+ - - ! '>='
59
69
  - !ruby/object:Gem::Version
60
70
  version: '0'
71
+ segments:
72
+ - 0
73
+ hash: -213964590511459667
61
74
  requirements: []
62
75
  rubyforge_project:
63
- rubygems_version: 2.0.3
76
+ rubygems_version: 1.8.24
64
77
  signing_key:
65
- specification_version: 4
78
+ specification_version: 3
66
79
  summary: Generates a diff by matching against user-defined matchers written in ruby.
67
80
  test_files:
68
81
  - spec/diff_matcher/difference_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 2868c9df6fcb0629a3b11aa0ff612fec55d83c7e
4
- data.tar.gz: db68ce3ce7834da9517bea0b7987537f3cbb3e85
5
- SHA512:
6
- metadata.gz: 57f3e4075c94f1ebf5f4ce3862df3c7ee6e32a39ee27eba9f37f65cd6d377686dfda4bcd8a62ae2a0379ad9780c11555dabc43e0e9faa03ea4aa190779c67c3f
7
- data.tar.gz: 0f5752354f037eed868ccf50fab9c0e84c6593cb710effa098555c73aadc89327bd110cd30d5c2e64360dcf3a42020ab0ab985ae7633306f08a845e6ae30cc00