argspec 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f6a9d2738f76290fa9b362e0b324eb6e60c3318
4
- data.tar.gz: 5c70bae7e6ddd2d018ba54d42aaa81ba46f57414
3
+ metadata.gz: 2fa42c2bea6a6433b6a114cf621d2f47e9b22fe4
4
+ data.tar.gz: e0a02ac0188c8b9b600e9b20f51009fb06de8bb7
5
5
  SHA512:
6
- metadata.gz: b49f0e5af1ee8057b7fe1bf820155b24b6242b3e7cf47f19c99f42d0916b63c14f33631b1deb9ad360b165467a26263a93ae473991aaa766926bc78ed54f4836
7
- data.tar.gz: 7d260f1446eb41e61b7d54ca30d170c745f40e1a5d946fa8db8969e038370684d55a0553b1ba17c20d2c9e1603ac4e4f3d7300adf6c744139ac35840cca31ed6
6
+ metadata.gz: 1d39fd2603deb79d5d8b07dce6db47b076fafb9847d2d85ab904ffda0d33b5332ed545ac4f5dc025ec9df01c2b47395796d06ae9ce66a4713af0c21f6e04c85f
7
+ data.tar.gz: 4917375026c94b0e4655b5f515067903cf4aa623d68b9739b29c6bb637ca30d7345e8fbc26b9847755ed21db96554cf02db590cf5b39d68ef6b6568d4bda865b
@@ -1,3 +1,3 @@
1
1
  module ArgumentSpecification
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  module ArgumentSpecification
2
2
  module Matchers
3
3
  class Cover < BaseMatcher
4
- matcher_name :cover
4
+ matcher_name :cover, :contain
5
5
 
6
6
  attr_reader :values
7
7
 
@@ -11,8 +11,8 @@ module ArgumentSpecification
11
11
  # values: (Splat)
12
12
  #
13
13
  # Example:
14
- # >> ArgumentSpecification::Matchers::Cover.new(1, 2)
15
- # => #<ArgumentSpecification::Matchers::Cover:0x00000000000000 @values=[1, 2]>
14
+ # >> ArgumentSpecification::Matchers::Cover.new(:a, :b)
15
+ # => #<ArgumentSpecification::Matchers::Cover:0x00000000000000 @values=[:a, :b]>
16
16
  #
17
17
  def initialize(*values)
18
18
  @values = values
@@ -25,8 +25,12 @@ module ArgumentSpecification
25
25
  # => true
26
26
  #
27
27
  def matches?
28
- @values.each do |value|
29
- return false unless @actual.include?(value)
28
+ symbol = @actual.is_a?(Symbol)
29
+ actual = symbol ? @actual.to_s : @actual
30
+ values = symbol ? @values.map { |v| v.is_a?(Symbol) ? v.to_s : v } : @values
31
+
32
+ values.each do |value|
33
+ return false unless actual.include?(value)
30
34
  end
31
35
 
32
36
  true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: argspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nialto Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,7 +86,6 @@ files:
86
86
  - lib/argspec/matchers/be_truthy.rb
87
87
  - lib/argspec/matchers/be_within_range.rb
88
88
  - lib/argspec/matchers/case_equal.rb
89
- - lib/argspec/matchers/contain.rb
90
89
  - lib/argspec/matchers/cover.rb
91
90
  - lib/argspec/matchers/end_with.rb
92
91
  - lib/argspec/matchers/equal.rb
@@ -1,32 +0,0 @@
1
- module ArgumentSpecification
2
- module Matchers
3
- class Contain < BaseMatcher
4
- matcher_name :contain
5
-
6
- attr_reader :expected
7
-
8
- # Create a new matcher instance
9
- #
10
- # Arguments:
11
- # expected: (Object)
12
- #
13
- # Example:
14
- # >> ArgumentSpecification::Matchers::Contain.new(Symbol)
15
- # => #<ArgumentSpecification::Matchers::Contain:0x00000000000000 @expected=Symbol>
16
- #
17
- def initialize(expected)
18
- @expected = expected
19
- end
20
-
21
- # Check if the actual object matches
22
- #
23
- # Example:
24
- # >> matcher.matches?
25
- # => true
26
- #
27
- def matches?
28
- @actual.include?(@expected)
29
- end
30
- end
31
- end
32
- end