expect 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +4 -0
- data/VERSION.semver +1 -1
- data/expect.gemspec +6 -5
- data/lib/expect.rb +0 -2
- data/lib/expect/expectation_target.rb +10 -10
- data/test/support/coverage.rb +3 -0
- data/test/test_be_false.rb +8 -0
- data/test/test_be_nil.rb +8 -0
- data/test/test_be_true.rb +8 -0
- data/test/test_eql.rb +8 -0
- data/test/test_equal.rb +8 -0
- data/test/test_match.rb +8 -0
- data/test/test_raise_exception.rb +8 -0
- metadata +16 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7de6846baf7cc1312493683ed571e4a740b0cdcd
|
4
|
+
data.tar.gz: 01a45a776cb1d2d08694108db3792bb95692ea98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9306020622f8ce7b24deadf68750834b6a80be8548d2301667ceeb6a07cca3e5c0594e0f6297ea7981365bbb4fa5a3d8c1c791adae51e7a8b129a2cb30fcf0c
|
7
|
+
data.tar.gz: 6df8893e96b4b1ed8c0d6531795a8814533327b7a45a84036f139649d56cda6d69d1ef8f626638977baf7c9bdb7e661ee1ddcc95f6f5d764cde9db7a4226b1b8
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -73,3 +73,7 @@ __Expect__ follows [Semantic Versioning 2.0](http://semver.org/).
|
|
73
73
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
74
74
|
4. Push to the branch (`git push origin my-new-feature`)
|
75
75
|
5. Create a new Pull Request
|
76
|
+
|
77
|
+
## License
|
78
|
+
|
79
|
+
See `LICENSE.md` file.
|
data/VERSION.semver
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.11
|
data/expect.gemspec
CHANGED
@@ -9,15 +9,16 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.homepage = 'https://github.com/fixrb/expect'
|
10
10
|
spec.license = 'MIT'
|
11
11
|
|
12
|
-
spec.files
|
13
|
-
|
12
|
+
spec.files =
|
13
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(/%r{^test}/) }
|
14
|
+
spec.executables = spec.files.grep(/%r{^exe}/) { |f| File.basename(f) }
|
14
15
|
spec.require_paths = ['lib']
|
15
16
|
|
16
|
-
spec.add_dependency 'matchi', '~> 0.0.
|
17
|
+
spec.add_dependency 'matchi', '~> 0.0.6'
|
17
18
|
|
18
19
|
spec.add_development_dependency 'bundler', '~> 1.9'
|
19
20
|
spec.add_development_dependency 'rake', '~> 10.4'
|
20
21
|
spec.add_development_dependency 'yard', '~> 0.8'
|
21
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
22
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
22
|
+
spec.add_development_dependency 'simplecov', '~> 0.10'
|
23
|
+
spec.add_development_dependency 'rubocop', '~> 0.31'
|
23
24
|
end
|
data/lib/expect.rb
CHANGED
@@ -4,8 +4,6 @@ module Expect
|
|
4
4
|
# Wraps the target of an expectation. This class is responsible for reporting
|
5
5
|
# if the expectation is true or false.
|
6
6
|
#
|
7
|
-
# @api private
|
8
|
-
#
|
9
7
|
# @example
|
10
8
|
# ExpectationTarget.new { 42 }.to Equal: 42 # => true
|
11
9
|
class ExpectationTarget
|
@@ -19,13 +17,15 @@ module Expect
|
|
19
17
|
@actual = actual
|
20
18
|
end
|
21
19
|
|
20
|
+
# @return [BasicObject] the object to be compared with the expected one
|
21
|
+
# though the matcher.
|
22
|
+
#
|
22
23
|
attr_reader :actual
|
23
24
|
|
24
25
|
# Evaluate to a positive assertion.
|
25
26
|
#
|
26
|
-
# @
|
27
|
-
#
|
28
|
-
# @param [Hash, Symbol] definition
|
27
|
+
# @param definition [Array, Hash, Symbol] The definition of the expected
|
28
|
+
# value.
|
29
29
|
#
|
30
30
|
# @return [Boolean] report if the expectation is true or false
|
31
31
|
def to(definition)
|
@@ -34,20 +34,20 @@ module Expect
|
|
34
34
|
|
35
35
|
# Evaluate to a negative assertion.
|
36
36
|
#
|
37
|
-
# @
|
37
|
+
# @param (see #to)
|
38
38
|
#
|
39
|
-
# @
|
40
|
-
#
|
41
|
-
# @return [Boolean] report if the expectation is not true or not false
|
39
|
+
# @return (see #to)
|
42
40
|
def not_to(definition)
|
43
41
|
!to(definition)
|
44
42
|
end
|
45
43
|
|
46
44
|
private
|
47
45
|
|
46
|
+
# @api private
|
47
|
+
#
|
48
48
|
# Load the matcher.
|
49
49
|
#
|
50
|
-
# @param
|
50
|
+
# @param (see #to)
|
51
51
|
#
|
52
52
|
# @return [#matches?] the matcher
|
53
53
|
def matcher(definition)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative File.join 'support', 'coverage'
|
2
|
+
require_relative File.join '..', 'lib', 'expect'
|
3
|
+
|
4
|
+
# It is expected to be false
|
5
|
+
fail unless Expect.this { false }.to(:BeFalse)
|
6
|
+
|
7
|
+
# It is expected to not be false
|
8
|
+
fail if Expect.this { false }.not_to(:BeFalse)
|
data/test/test_be_nil.rb
ADDED
data/test/test_eql.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative File.join 'support', 'coverage'
|
2
|
+
require_relative File.join '..', 'lib', 'expect'
|
3
|
+
|
4
|
+
# It is expected to be equivalent to 'foo'
|
5
|
+
fail unless Expect.this { 'foo' }.to(Eql: 'foo')
|
6
|
+
|
7
|
+
# It is expected to not be equivalent to 'foo'
|
8
|
+
fail if Expect.this { 'foo' }.not_to(Eql: 'foo')
|
data/test/test_equal.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative File.join 'support', 'coverage'
|
2
|
+
require_relative File.join '..', 'lib', 'expect'
|
3
|
+
|
4
|
+
# It is expected to identity :foo
|
5
|
+
fail unless Expect.this { :foo }.to(Equal: :foo)
|
6
|
+
|
7
|
+
# It is expected to not identity :foo
|
8
|
+
fail if Expect.this { :foo }.not_to(Equal: :foo)
|
data/test/test_match.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative File.join 'support', 'coverage'
|
2
|
+
require_relative File.join '..', 'lib', 'expect'
|
3
|
+
|
4
|
+
# It is expected to match /^foo$/
|
5
|
+
fail unless Expect.this { 'foo' }.to(Match: /^foo$/)
|
6
|
+
|
7
|
+
# It is expected to not identity :foo
|
8
|
+
fail if Expect.this { 'foo' }.not_to(Match: /^foo$/)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative File.join 'support', 'coverage'
|
2
|
+
require_relative File.join '..', 'lib', 'expect'
|
3
|
+
|
4
|
+
# It is expected to raise the exception NameError
|
5
|
+
fail unless Expect.this { Boom }.to(RaiseException: NameError)
|
6
|
+
|
7
|
+
# It is expected to not raise the exception NameError
|
8
|
+
fail if Expect.this { Boom }.not_to(RaiseException: NameError)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Wack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: matchi
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.
|
26
|
+
version: 0.0.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: '0.10'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: '0.10'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
89
|
+
version: '0.31'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
96
|
+
version: '0.31'
|
97
97
|
description: Expectation library with some matchers for Ruby.
|
98
98
|
email:
|
99
99
|
- contact@cyril.email
|
@@ -115,6 +115,14 @@ files:
|
|
115
115
|
- expect.gemspec
|
116
116
|
- lib/expect.rb
|
117
117
|
- lib/expect/expectation_target.rb
|
118
|
+
- test/support/coverage.rb
|
119
|
+
- test/test_be_false.rb
|
120
|
+
- test/test_be_nil.rb
|
121
|
+
- test/test_be_true.rb
|
122
|
+
- test/test_eql.rb
|
123
|
+
- test/test_equal.rb
|
124
|
+
- test/test_match.rb
|
125
|
+
- test/test_raise_exception.rb
|
118
126
|
homepage: https://github.com/fixrb/expect
|
119
127
|
licenses:
|
120
128
|
- MIT
|