expect 0.0.5 → 0.0.6

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: 99379ef3eb25d3685737ab9e96c0a00ccb5eb7bb
4
- data.tar.gz: 7bd04246acbb9383237be81ad6094ff884aa3cb8
3
+ metadata.gz: edc3cd88e9d05092903a37838fc4d788a0c060ed
4
+ data.tar.gz: 461f336b1737e23b37c009bc412c9ae69e617326
5
5
  SHA512:
6
- metadata.gz: 39caad399aff88c30c0697cfedb4ca1e1a490af82a2977bccfe46b0c8941c56a64268cb6b92ca676ce65c436297a8ce34e6d4ce55622300c84a0963ceecf3cea
7
- data.tar.gz: fbf211784188587680a43b294c69dc53f7728e28869fd69eec107a53251e749f52b1a87b57a307fde6c5c9bf2829fd6a52406744558ca6817455e2a628558a39
6
+ metadata.gz: f25544ad61c275a1333db030c42c8b30f36387c966ee98f49e30d6f3eca6c0c5ee478c7a3051b498861b6ac620975ef1fd16346deeb87171449fb27af4dc3e98
7
+ data.tar.gz: 23084bb45623b3a53aaedb056868f2556297c44b01b8834a3a8581b6ecd3dc4f2d08eef877d962fd853f0821ccf9a3d9fd60de0ed0bf39e0a9aaf00d179320ef
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -2,7 +2,10 @@ require_relative File.join 'expect', 'expectation_target'
2
2
 
3
3
  # Namespace for the Expect library.
4
4
  #
5
- # @api private
5
+ # @api public
6
+ #
7
+ # @example Expect 42 to be equal to 42
8
+ # Expect.this { 42 }.to equal: 42 # => true
6
9
  module Expect
7
10
  # Expectations are built with this method.
8
11
  #
@@ -14,7 +14,9 @@ module Expect
14
14
  #
15
15
  # @api public
16
16
  #
17
- # @see Matcher#pass?
17
+ # @param [Hash, Symbol] definition
18
+ #
19
+ # @return [Boolean] report if the expectation is true or false
18
20
  def to(definition)
19
21
  Matcher.pass?(definition, &@actual)
20
22
  end
@@ -23,7 +25,9 @@ module Expect
23
25
  #
24
26
  # @api public
25
27
  #
26
- # @see Matcher#pass?
28
+ # @param [Hash, Symbol] definition
29
+ #
30
+ # @return [Boolean] report if the expectation is true or false
27
31
  def not_to(definition)
28
32
  to(definition).equal?(false)
29
33
  end
@@ -5,25 +5,16 @@ module Expect
5
5
  module Matcher
6
6
  # Evaluate the expectation with the passed block.
7
7
  #
8
- # @param [Hash] definition
8
+ # @param [Hash, Symbol] definition
9
9
  #
10
- # @return [Boolean] Report if the expectation is true or false.
10
+ # @return [Boolean] report if the expectation is true or false
11
11
  def self.pass?(definition, &actual)
12
- params = Array(definition).flatten 1
13
- name = params.first
12
+ params = Array(definition).flatten(1)
13
+ name = params.first.to_s.split('_').map(&:capitalize).join.to_sym
14
14
  expected_args = params[1..-1]
15
- matcher = get(name).new(*expected_args)
15
+ matcher = Matchi.const_get(name).new(*expected_args)
16
16
 
17
17
  matcher.matches?(&actual)
18
18
  end
19
-
20
- # Get the class of a matcher from its symbol.
21
- #
22
- # @example
23
- #
24
- # Matcher.get(:eql) # => Eql
25
- def self.get(name)
26
- Matchi.const_get name.to_s.split('_').map(&:capitalize).join.to_sym
27
- end
28
19
  end
29
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Wack