rspec-eventually 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/Rakefile +1 -1
- data/lib/rspec/eventually.rb +3 -3
- data/lib/rspec/eventually/version.rb +1 -1
- data/rspec-eventually.gemspec +4 -4
- data/spec/eventually_spec.rb +6 -9
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8d722021dde9d5863e9b848b9f89b91d23c7417
|
4
|
+
data.tar.gz: 5adeabc5eb68fa630b0a77d5071c695734df1729
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3a528dfe3b61ad7170c0ec804d87479d44388cadf1d659dd0bcf1560134e4f1a56fb239799fabde7cd17caf5f87d8cd7b1c7cd8293678185deb20c370dbdbaa
|
7
|
+
data.tar.gz: 9efa3772d8eeb31a2a247ddf66587ffa5487a106c57bc8c53a9b084607aeae7bf9532125c0b63b2a8473071f20d6fdf0d9ec839299e41b3796af0d66450fc9a1
|
data/.rubocop.yml
CHANGED
data/Rakefile
CHANGED
data/lib/rspec/eventually.rb
CHANGED
@@ -31,12 +31,12 @@ module Rspec
|
|
31
31
|
def matches?(expected_block)
|
32
32
|
Timeout.timeout(timeout) { eventually_matches? expected_block }
|
33
33
|
rescue Timeout::Error
|
34
|
-
@tries
|
34
|
+
@tries.zero? && raise('Timeout before first evaluation, use a longer `eventually` timeout \
|
35
35
|
or shorter `eventually` pause')
|
36
36
|
end
|
37
37
|
|
38
38
|
def does_not_match?
|
39
|
-
|
39
|
+
raise 'Use eventually_not instead of expect(...).to_not'
|
40
40
|
end
|
41
41
|
|
42
42
|
def failure_message
|
@@ -63,7 +63,7 @@ module Rspec
|
|
63
63
|
private
|
64
64
|
|
65
65
|
def eventually_matches?(expected_block)
|
66
|
-
target_matches?(expected_block) ||
|
66
|
+
target_matches?(expected_block) || raise(FailedMatcherError)
|
67
67
|
rescue StandardError => e
|
68
68
|
raise if !e.is_a?(FailedMatcherError) && !suppress_errors
|
69
69
|
sleep pause
|
data/rspec-eventually.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'rspec/eventually/version'
|
@@ -14,12 +14,12 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(
|
18
|
-
spec.test_files = spec.files.grep(
|
17
|
+
spec.executables = spec.files.grep(%r{^bin\/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
23
|
spec.add_development_dependency 'rspec', '~> 3.2'
|
24
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
24
|
+
spec.add_development_dependency 'rubocop', '~> 0.52'
|
25
25
|
end
|
data/spec/eventually_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Rspec
|
2
2
|
module Eventually
|
3
3
|
describe Eventually do
|
4
|
-
|
5
4
|
it 'eventually matches' do
|
6
5
|
value = 0
|
7
6
|
Thread.new do
|
@@ -9,7 +8,7 @@ module Rspec
|
|
9
8
|
value = 1
|
10
9
|
end
|
11
10
|
|
12
|
-
expect(Eventually.new(eq 1).matches?
|
11
|
+
expect(Eventually.new(eq 1).matches?(-> { value })).to be true
|
13
12
|
end
|
14
13
|
|
15
14
|
it 'eventually_not matches' do
|
@@ -19,15 +18,15 @@ module Rspec
|
|
19
18
|
value = 1
|
20
19
|
end
|
21
20
|
|
22
|
-
expect(Eventually.new(eq 0).not.matches?
|
21
|
+
expect(Eventually.new(eq 0).not.matches?(-> { value })).to be true
|
23
22
|
end
|
24
23
|
|
25
24
|
it 'eventually fails' do
|
26
|
-
expect(Eventually.new(eq 1).matches?
|
25
|
+
expect(Eventually.new(eq 1).matches?(-> { 0 })).to be false
|
27
26
|
end
|
28
27
|
|
29
28
|
it 'eventually_not fails' do
|
30
|
-
expect(Eventually.new(eq 1).not.matches?
|
29
|
+
expect(Eventually.new(eq 1).not.matches?(-> { 1 })).to be false
|
31
30
|
end
|
32
31
|
|
33
32
|
it 'has a configurable default timeout' do
|
@@ -60,7 +59,6 @@ module Rspec
|
|
60
59
|
matcher.matches? -> { 0 }
|
61
60
|
|
62
61
|
expect(matcher.instance_variable_get('@tries')).to eq 9
|
63
|
-
|
64
62
|
ensure
|
65
63
|
::Rspec::Eventually.pause = 0.1
|
66
64
|
end
|
@@ -92,7 +90,7 @@ module Rspec
|
|
92
90
|
|
93
91
|
it 'raises errors by default' do
|
94
92
|
block = lambda do
|
95
|
-
Eventually.new(eq 1).matches? -> {
|
93
|
+
Eventually.new(eq 1).matches? -> { raise 'I am throwing an error' }
|
96
94
|
end
|
97
95
|
|
98
96
|
expect { block.call }.to raise_error(/I am throwing an error/)
|
@@ -101,11 +99,10 @@ module Rspec
|
|
101
99
|
it 'can suppress errors' do
|
102
100
|
first = false
|
103
101
|
block = lambda do
|
104
|
-
|
105
102
|
one_eventually = lambda do
|
106
103
|
if first
|
107
104
|
first = false
|
108
|
-
|
105
|
+
raise 'I am throwing an error'
|
109
106
|
end
|
110
107
|
1
|
111
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-eventually
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hawk Newton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: '0.52'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: '0.52'
|
69
69
|
description: Enhances rspec DSL to include `eventually` and `eventually_not`
|
70
70
|
email:
|
71
71
|
- hawk.newton@gmail.com
|