rspec_typeof 0.3.0 → 0.3.1
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/lib/rspec_typeof/typeof.rb +7 -10
- data/lib/rspec_typeof/version.rb +1 -1
- data/rspec_typeof.gemspec +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: 304b54494c43ca8eed064e6965b27b8abd4a0004
|
4
|
+
data.tar.gz: 1c40686275cf7225e71102c666e82752dcd90b70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2b08e264523b075f80a6bc323289da1d71819be2a075bf8c414773daabe0fbb3d27059a94ea7e1cd53e2ecf25f69415b3980224c8f96919449e806a75f2d5b4
|
7
|
+
data.tar.gz: 5d4577278d3febadeb79422fba9b06e5e3908d12d0971be0ce6265ce7caeacf68166063ab6412e8e703799e285cb97f7ee25634ba11e5006fd6df616cee77ec6
|
data/lib/rspec_typeof/typeof.rb
CHANGED
@@ -8,7 +8,6 @@ RSpec::Matchers.define :typeof do |expected_types|
|
|
8
8
|
'boolean' => ['TrueClass', 'FalseClass']
|
9
9
|
}.freeze
|
10
10
|
|
11
|
-
array_matching = false
|
12
11
|
types = expected_types
|
13
12
|
.to_s
|
14
13
|
.gsub(/^array_of_/, '')
|
@@ -18,17 +17,15 @@ RSpec::Matchers.define :typeof do |expected_types|
|
|
18
17
|
.flatten
|
19
18
|
.uniq
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
20
|
+
match do |actual|
|
21
|
+
expect(actual).to satisfy do |x|
|
22
|
+
if expected_types.to_s.scan(/^array_of_\w+/).length > 0
|
23
|
+
x.all? { |el| types.include?(el.class.name) }
|
24
|
+
else
|
25
|
+
types.include?(x.class.name)
|
28
26
|
end
|
29
27
|
end
|
30
|
-
|
31
|
-
|
28
|
+
end
|
32
29
|
|
33
30
|
failure_message do |actual|
|
34
31
|
"expected that #{actual} would be an instance of #{types.join(' or ')}"
|
data/lib/rspec_typeof/version.rb
CHANGED
data/rspec_typeof.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.description = %q{Add typeof matcher to Rspec}
|
14
14
|
spec.homepage = "https://github.com/Somiel/rspec_typeof"
|
15
15
|
|
16
|
-
|
16
|
+
spec.licenses = ['MIT']
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
18
|
spec.bindir = "exe"
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_typeof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vovchuk Max
|
@@ -74,7 +74,8 @@ files:
|
|
74
74
|
- lib/utils/string.rb
|
75
75
|
- rspec_typeof.gemspec
|
76
76
|
homepage: https://github.com/Somiel/rspec_typeof
|
77
|
-
licenses:
|
77
|
+
licenses:
|
78
|
+
- MIT
|
78
79
|
metadata: {}
|
79
80
|
post_install_message:
|
80
81
|
rdoc_options: []
|