test-helpers 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 87fcbf64654e3417a6a321c393e5f7028c1ac642
4
- data.tar.gz: c3a22c69bf94c1ba23b92cd9f7d258b11dd308ae
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWJkODFjZThjNmIzZWQyOWJkODI0MTY0MWQ5MjU3NjUwYWFiMGE5YQ==
5
+ data.tar.gz: !binary |-
6
+ MDE2NGFjYjU3YzFhNzE4N2EyMzg0MDBiZDczMmRkYzBhZWM5MTg3NA==
5
7
  SHA512:
6
- metadata.gz: 119536d789563096df901074c9b7eb7e297f8a8dba5885bc32310ca2a1fad76af439812495325aef0f6b23c39d78c37b03a079cbced4c4547dc612f2b38556c3
7
- data.tar.gz: 1f6dd3f61dbc1371010d7e61173fa77528b41b9fe8c48380b494ca97f7ca3628cdd858ef547cf24dfdd47dacb6f204a8b9ad641b8dd2cf548eab1332ab744aa4
8
+ metadata.gz: !binary |-
9
+ N2FkODA0YmE0MzVmZjRiN2E4MjMyNGM4YTQzZjYwMWVmYTA5ZmNkOTkwZGVm
10
+ NDIyYzYwZDkzOTUzZjc2ZDk1ODlmMjMyNDNjODA1OGFjMzZkMTQ0ZWFkZGQx
11
+ YzVlOTY1ZjM3MDk4Njc2NzM2YzBiNjEwMDhmZmYwMDEwMjJmZjY=
12
+ data.tar.gz: !binary |-
13
+ MDYyYThhNzJiZThjYjZkNzdmMDM0NDgxNDQzYzM0MGU5NGY3MTYxOTZiMWVl
14
+ MmE0NjMyOTg2ZmFhODhkM2I0NDdmYzMwMTVkZDQ2ODdkZDdiNTE4MWMxOWU1
15
+ OGRkZTg0MjliNGJmMWRiYjlkNDg4YTYzNGI0NWY4Mjk5MWJhNWI=
@@ -0,0 +1,2 @@
1
+ require 'test-helpers/test-helpers'
2
+ require 'test-helpers/wait'
@@ -1,6 +1,4 @@
1
- project_root = File.expand_path(File.dirname(__FILE__))
2
- Dir.glob(project_root + '/helpers/*.rb').each { |file| require file }
3
-
1
+ $LOAD_PATH << File.dirname(__FILE__)
4
2
  module TestHelpers
5
3
  class << self
6
4
  attr_accessor :configuration
@@ -0,0 +1,41 @@
1
+ module TestHelpers
2
+ module Wait
3
+ def poll_and_assert(options = {})
4
+ return unless block_given?
5
+ timeout = Float(options[:timeout] || TestHelpers.configuration.wait_timeout)
6
+ interval = Float(options[:interval] || TestHelpers.configuration.wait_interval)
7
+ end_time = ::Time.now + timeout
8
+ failure = nil
9
+ until ::Time.now > end_time
10
+ begin
11
+ result = yield
12
+ return result if result
13
+ rescue ::RSpec::Expectations::ExpectationNotMetError => e
14
+ failure = e
15
+ sleep interval
16
+ end
17
+ end
18
+ raise failure
19
+ end
20
+
21
+ def wait_until(options = {})
22
+ return unless block_given?
23
+ timeout = Float(options[:timeout] || TestHelpers.configuration.wait_timeout)
24
+ interval = Float(options[:interval] || TestHelpers.configuration.wait_interval)
25
+ error = options[:error] || TestHelpers.configuration.default_error
26
+ end_time = ::Time.now + timeout
27
+ until ::Time.now > end_time
28
+ begin
29
+ result = yield
30
+ return result if result
31
+ rescue ::StandardError
32
+ sleep interval
33
+ end
34
+ end
35
+ result = yield
36
+ return result if result
37
+ raise error
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,2 @@
1
+ require 'test-helpers/test-helpers'
2
+ require 'test-helpers/wait/wait'
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - Umair Chagani
7
+ - Umair Chagani, Manheim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
@@ -14,14 +14,14 @@ dependencies:
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2'
27
27
  - !ruby/object:Gem::Dependency
@@ -39,12 +39,15 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: A collection of helpers.
42
- email: umair.chagani@manheim.com
42
+ email: umair.chagani@manheim.com, cloudops@manheim.com
43
43
  executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
- - lib/test-helpers.rb
47
+ - lib/test-helpers/all.rb
48
+ - lib/test-helpers/test-helpers.rb
49
+ - lib/test-helpers/wait.rb
50
+ - lib/test-helpers/wait/wait.rb
48
51
  homepage: http://github.com/manheim/test-helpers
49
52
  licenses:
50
53
  - MIT
@@ -55,17 +58,17 @@ require_paths:
55
58
  - lib
56
59
  required_ruby_version: !ruby/object:Gem::Requirement
57
60
  requirements:
58
- - - '>='
61
+ - - ! '>='
59
62
  - !ruby/object:Gem::Version
60
- version: '0'
63
+ version: 1.9.3
61
64
  required_rubygems_version: !ruby/object:Gem::Requirement
62
65
  requirements:
63
- - - '>='
66
+ - - ! '>='
64
67
  - !ruby/object:Gem::Version
65
68
  version: '0'
66
69
  requirements: []
67
70
  rubyforge_project:
68
- rubygems_version: 2.4.6
71
+ rubygems_version: 2.4.8
69
72
  signing_key:
70
73
  specification_version: 4
71
74
  summary: Test helpers!