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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95f25fba6427d1d12273581efe60dfecdda04e65
4
- data.tar.gz: 6a9bb02287f285d58cafeaa9705b7fe40ae239d4
3
+ metadata.gz: f8d722021dde9d5863e9b848b9f89b91d23c7417
4
+ data.tar.gz: 5adeabc5eb68fa630b0a77d5071c695734df1729
5
5
  SHA512:
6
- metadata.gz: b9a666e1d8331a53512e5226701a7f00bf3ca606f9be728c1cb9de71028abd4bfdd941fa056c637ac47a0b483efad12c395f32c76212c049fed6bb8075a18a11
7
- data.tar.gz: 5034559418f24b9de333dc7e3fe907377cd7cf5ceea2baa223f84c2a1dd083cd93754bc8a6436e5fc9ede2ef4fd2da9a5d88ef2d4e62b924c9fd6caae36892ea
6
+ metadata.gz: f3a528dfe3b61ad7170c0ec804d87479d44388cadf1d659dd0bcf1560134e4f1a56fb239799fabde7cd17caf5f87d8cd7b1c7cd8293678185deb20c370dbdbaa
7
+ data.tar.gz: 9efa3772d8eeb31a2a247ddf66587ffa5487a106c57bc8c53a9b084607aeae7bf9532125c0b63b2a8473071f20d6fdf0d9ec839299e41b3796af0d66450fc9a1
@@ -13,3 +13,12 @@ Style/Documentation:
13
13
  Style/DotPosition:
14
14
  Enabled: true
15
15
  EnforcedStyle: trailing
16
+
17
+ Metrics/BlockLength:
18
+ Exclude:
19
+ - 'spec/**/*.rb'
20
+ - '*.gemspec'
21
+
22
+ Metrics/ModuleLength:
23
+ Exclude:
24
+ - 'spec/**/*.rb'
data/Rakefile CHANGED
@@ -5,4 +5,4 @@ require 'rspec/core/rake_task'
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
  RuboCop::RakeTask.new
7
7
 
8
- task default: [:spec, :rubocop]
8
+ task default: %i[spec rubocop]
@@ -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 == 0 && raise('Timeout before first evaluation, use a longer `eventually` timeout \
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
- fail 'Use eventually_not instead of expect(...).to_not'
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) || fail(FailedMatcherError)
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
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module Eventually
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'.freeze
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- # coding: utf-8
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(/^bin\//) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(/^(test|spec|features)\//)
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.27.1'
24
+ spec.add_development_dependency 'rubocop', '~> 0.52'
25
25
  end
@@ -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? -> { value }).to be true
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? -> { value }).to be true
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? -> { 0 }).to be false
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? -> { 1 }).to be false
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? -> { fail 'I am throwing an error' }
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
- fail 'I am throwing an error'
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.1
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-12 00:00:00.000000000 Z
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.27.1
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.27.1
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