waiter_ 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/version.rb +1 -1
  3. data/lib/waiter.rb +14 -3
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e268b47f92c2f681a1574ce1fe621c31a391fed
4
- data.tar.gz: e5361387d097b61bd4a7cb16690c3e56c69579b5
3
+ metadata.gz: 909e96c5ced33dfb6f5c9368dc7b5be54b9c9067
4
+ data.tar.gz: 6fa22187527c5683da094f72465e4d81f85863c6
5
5
  SHA512:
6
- metadata.gz: a3a8c53b6dc3e0173a4d839eed61ae4ff286c23fe9556a0a5e3737d087fcb14c58dc4c9b9604eff16e5da52159aac0b4147efcbe5bebd53b40a5ce6c021a814f
7
- data.tar.gz: 01dde6fe0567b1af0abb61c6caaec4bfac818715ca7ddd69929b22bbb734b98a8c73736c4b333451f2ff259a4ae16b5f02ce6a0296945e28cb04f926f2ea13bd
6
+ metadata.gz: 13fe2e2a265865e12fb97bf6c762e278ef7513354943197f90cab95237238b90eeff3fc0d3f338eb5d09501d33fdc6cdbe4ac937ae86169b7f77f3c16b7819d1
7
+ data.tar.gz: 11897bd6ce6b84025514c37005906e518c6644fe2afe25e72b11b123495f9b2c53e6db9f0179672c82d5e0f509a4009c70fbd48bff8aef604677911adeb0656e
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Waiter
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
data/lib/waiter.rb CHANGED
@@ -60,7 +60,7 @@ module Waiter
60
60
  def initialize(opts = {})
61
61
  @timeout = opts[:timeout] || DEFAULT_TIMEOUT
62
62
  @polling = opts[:polling] || DEFAULT_POLLING
63
- @failure_message = opts[:failure_message] || build_error
63
+ @failure_message = opts[:failure_message] || default_failure_message
64
64
  end
65
65
 
66
66
  def for(value = nil, &block)
@@ -84,6 +84,11 @@ module Waiter
84
84
  end
85
85
  alias_method :polling_every, :every
86
86
 
87
+ def fail_with(message)
88
+ @failure_message = message
89
+ self
90
+ end
91
+
87
92
  def to(matcher = nil, &block)
88
93
  WaitExpectationTarget.new(@target).to(self, matcher, &block)
89
94
  end
@@ -130,10 +135,16 @@ module Waiter
130
135
 
131
136
  private
132
137
 
133
- def build_error(error = nil)
138
+ def default_failure_message
134
139
  [
135
140
  "Timed out after waiting for #{@timeout}s.",
136
- "Polled for #{@polling}s.",
141
+ "Polled for #{@polling}s."
142
+ ].join("\n")
143
+ end
144
+
145
+ def build_error(error = nil)
146
+ [
147
+ @failure_message,
137
148
  error
138
149
  ].join("\n")
139
150
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waiter_
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek McNeil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-expectations