rspec-deep-ignore-order-matcher 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# RSpec Deep Matcher
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rspec-deep-ignore-order-matcher.png)](http://badge.fury.io/rb/rspec-deep-ignore-order-matcher)
|
4
|
+
|
3
5
|
This gem adds a custom matcher to RSpec to recursively compare nested Ruby data-structures consisting of Hash and Array elements.
|
4
6
|
An order of elements in an array is ignored.
|
5
7
|
|
6
8
|
## Install
|
7
9
|
```
|
8
|
-
|
10
|
+
gem install rspec-deep-ignore-order-matcher
|
9
11
|
```
|
10
12
|
or add to your `Gemfile`
|
11
13
|
```
|
data/spec/matcher_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require 'rspec-deep-ignore-order-matcher'
|
|
4
4
|
describe Deep::Ignore::Order::Matcher do
|
5
5
|
|
6
6
|
it 'should matches usual values' do
|
7
|
-
['an_string', 1, 13.5, nil, [1, 2, 3], { :
|
7
|
+
['an_string', 1, 13.5, nil, [1, 2, 3], { a: 1, b: 2 }].each_slice(2) do |value1, value2|
|
8
8
|
value1.should be_deep_equal value1
|
9
9
|
value2.should be_deep_equal value2
|
10
10
|
value1.should_not be_deep_equal value2
|
@@ -19,8 +19,8 @@ describe Deep::Ignore::Order::Matcher do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should match deep structs' do
|
22
|
-
actual = [{ :
|
23
|
-
expected = [{ :
|
22
|
+
actual = [{ a: 1, b: 'str', c: [1, 2, 3] }, [{ a: [2, { a: 4 }] }, { b: 2 }, { c: 3 }]]
|
23
|
+
expected = [{ a: 1, b: 'str', c: [3, 1, 2] }, [{ b: 2 }, { a: [{ a: 4 }, 2] }, { c: 3 }]]
|
24
24
|
actual.should be_deep_equal expected
|
25
25
|
actual[0][:c].push(4)
|
26
26
|
actual.should_not be_deep_equal expected
|
@@ -29,11 +29,11 @@ describe Deep::Ignore::Order::Matcher do
|
|
29
29
|
it 'should do not match partials' do
|
30
30
|
[1, 2, 3].should_not be_deep_equal [1, 2]
|
31
31
|
[1, 2].should_not be_deep_equal [1, 2, 3]
|
32
|
-
{ :
|
33
|
-
{ :
|
32
|
+
{ a: 1, b: 2 }.should_not be_deep_equal({ a: 1 })
|
33
|
+
{ a: 1 }.should_not be_deep_equal({ a: 1, b: 2 })
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should ignore hash keys order' do
|
37
|
-
{ :
|
37
|
+
{ a: 1, b: 2 }.should be_deep_equal({ b: 2, a: 1 })
|
38
38
|
end
|
39
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-deep-ignore-order-matcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -27,22 +27,6 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '2.6'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: simplecov
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
30
|
description: This gem adds a custom matcher to RSpec to recursively compare nested
|
47
31
|
Ruby data-structures consisting of `Hash` and `Array` elements. An order of elements
|
48
32
|
in an array is ignored.
|
@@ -81,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
65
|
version: '0'
|
82
66
|
requirements: []
|
83
67
|
rubyforge_project:
|
84
|
-
rubygems_version: 1.8.
|
68
|
+
rubygems_version: 1.8.23
|
85
69
|
signing_key:
|
86
70
|
specification_version: 3
|
87
71
|
summary: A custom matcher to RSpec to recursively compare nested Ruby data-structures
|