interface_comparator 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/lib/interface_comparator/minitest.rb +17 -0
- data/lib/interface_comparator/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab52ecbe5d7bbe7c2135073b650a96e7a68df233
|
4
|
+
data.tar.gz: 0ee0f8b979afa011e8ef340c8834befa603ea244
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a72e81effab2c519c736284cdb6bf22f7c6ffa1918f1053b2a5922c6b360fd8472ae3ab6a1ff9b6937a300e29b9f75d75f5c68607bcd6762c3fc1d04ca77ae6
|
7
|
+
data.tar.gz: ca6ebad2c0e5cd90e8c2d6e2adb3ffd98b862e65b6ccc868b44c58fe753c389ea4d3dd0c09ac6fb3740d0b79f2375212854a552317fb655537b5018e41a92c96
|
data/README.md
CHANGED
@@ -45,6 +45,20 @@ InterfaceComparator.diff_interfaces(a, b)
|
|
45
45
|
#}]
|
46
46
|
```
|
47
47
|
|
48
|
+
## Usage with minitest
|
49
|
+
|
50
|
+
If you want to use it with minitest, please require helper:
|
51
|
+
```ruby
|
52
|
+
require 'interface_comparator/minitest'
|
53
|
+
```
|
54
|
+
|
55
|
+
Library will provide you with two new assertions:
|
56
|
+
```ruby
|
57
|
+
assert_equal_interfaces a, b
|
58
|
+
refute_equal_interfaces a, b
|
59
|
+
```
|
60
|
+
|
61
|
+
Output in case of failure will be similar to those in diff_interfaces.
|
48
62
|
|
49
63
|
## Development
|
50
64
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Minitest::Assertions
|
2
|
+
#
|
3
|
+
# Fails unless +object_a and +object_a have the same interfaces (in terms of method and their arity).
|
4
|
+
#
|
5
|
+
def assert_equal_interfaces(object_a, object_b)
|
6
|
+
assert InterfaceComparator.interfaces_are_same?(object_a, object_b),
|
7
|
+
"Interfaces are not the same: #{InterfaceComparator.diff_interfaces(object_a, object_b)}"
|
8
|
+
end
|
9
|
+
|
10
|
+
#
|
11
|
+
# Fails if +object_a and +object_a have the same interfaces (in terms of method and their arity).
|
12
|
+
#
|
13
|
+
def refute_equal_interfaces(object_a, object_b)
|
14
|
+
refute InterfaceComparator.interfaces_are_same?(object_a, object_b),
|
15
|
+
"Interfaces are of these two object are the same"
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interface_comparator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Szmielew
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- bin/setup
|
85
85
|
- interface_comparator.gemspec
|
86
86
|
- lib/interface_comparator.rb
|
87
|
+
- lib/interface_comparator/minitest.rb
|
87
88
|
- lib/interface_comparator/version.rb
|
88
89
|
homepage: https://github.com/esse/interface_comparator
|
89
90
|
licenses:
|
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
106
|
version: '0'
|
106
107
|
requirements: []
|
107
108
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.6.11
|
109
110
|
signing_key:
|
110
111
|
specification_version: 4
|
111
112
|
summary: Module that checks if two objects has the same interface including public
|