wist 0.3.1 → 0.4.0

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: 4aa5f441eb74f8fae874d4e3493410d32fdb11a1
4
- data.tar.gz: eea7f1657d43671176f1ce373daf62f0742d190e
3
+ metadata.gz: 10cca54a428e9d773cbae796707143783b12243b
4
+ data.tar.gz: 32c6af1c6f59d2728fc5432a96733ab171aca930
5
5
  SHA512:
6
- metadata.gz: 565621550f29574538d051cbf9176682894b97a1379fc54914cdf26eb8a694bf856e49fdb28b7873346516163c595b22fd5505a7a0eba85ba0b6b611db3ddffb
7
- data.tar.gz: 18b403d2a1634b5beb53e6bd54cda75ef42842ac2e4e6ddc740604f5467e14ae12e4bccfcb88dff8ecf7e06c9b512bc20e4c2a6c78532323f6ef365656a809e4
6
+ metadata.gz: 9b918cd234dfd215ff897054d2e492fec8cd4e665d4bebf385e5fda7dcc4e9c1d20c33c94256561ec785c861655393d510dd7a6ec1ee63a7e48a7630a668f6d3
7
+ data.tar.gz: ca47d1828c1a1d5754e13a593d4f9e6aa2b1d685cc6bd8a951ecf87528ca169e3b859de75a6d70f8060b9b081e0e8fb23c6d594738c8eb8b42f613876f896d9d
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org/'
2
2
  gemspec
3
3
 
4
- gem 'capybara', '2.4.4'
4
+ gem 'capybara', '2.5.0'
5
5
  gem 'pry'
6
6
  gem 'rake'
7
7
  gem "poltergeist", "1.5.1"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wist (0.3.1)
4
+ wist (0.4.0)
5
5
  capybara
6
6
  selenium-webdriver
7
7
 
@@ -10,7 +10,7 @@ GEM
10
10
  specs:
11
11
  ansi (1.5.0)
12
12
  builder (3.2.2)
13
- capybara (2.4.4)
13
+ capybara (2.5.0)
14
14
  mime-types (>= 1.16)
15
15
  nokogiri (>= 1.3.3)
16
16
  rack (>= 1.0.0)
@@ -22,7 +22,7 @@ GEM
22
22
  coderay (1.0.9)
23
23
  ffi (1.9.10)
24
24
  method_source (0.8.2)
25
- mime-types (2.4.3)
25
+ mime-types (2.6.2)
26
26
  mini_portile (0.6.2)
27
27
  minitest (5.5.1)
28
28
  minitest-reporters (1.0.11)
@@ -42,13 +42,13 @@ GEM
42
42
  coderay (~> 1.0.5)
43
43
  method_source (~> 0.8)
44
44
  slop (~> 3.4)
45
- rack (1.6.0)
45
+ rack (1.6.4)
46
46
  rack-test (0.6.3)
47
47
  rack (>= 1.0)
48
48
  rake (10.1.0)
49
49
  ruby-progressbar (1.7.1)
50
50
  rubyzip (1.1.7)
51
- selenium-webdriver (2.46.2)
51
+ selenium-webdriver (2.47.1)
52
52
  childprocess (~> 0.5)
53
53
  multi_json (~> 1.0)
54
54
  rubyzip (~> 1.0)
@@ -63,7 +63,7 @@ PLATFORMS
63
63
  ruby
64
64
 
65
65
  DEPENDENCIES
66
- capybara (= 2.4.4)
66
+ capybara (= 2.5.0)
67
67
  minitest-reporters
68
68
  poltergeist (= 1.5.1)
69
69
  pry
data/lib/wist.rb CHANGED
@@ -11,8 +11,16 @@ module Wist
11
11
  attr_accessor(:rspec_should)
12
12
  attr_accessor(:rspec_expect)
13
13
  attr_accessor(:assert_syntax_detected)
14
+ attr_accessor(:wait_time_method)
14
15
  end
15
16
 
17
+ self.wait_time_method = if defined?(Capybara.default_max_wait_time)
18
+ :default_max_wait_time
19
+ else
20
+ :default_wait_time
21
+ end
22
+
23
+
16
24
  module Helpers
17
25
  module_function
18
26
 
@@ -217,19 +225,23 @@ module Wist
217
225
  do_instantly { has_css?(*args) }
218
226
  end
219
227
 
228
+ def get_capybara_wait_time
229
+ Capybara.public_send(Wist.wait_time_method)
230
+ end
231
+
220
232
  def do_instantly
221
233
  lambda do
222
- default_wait_time = Capybara.default_wait_time
223
- @old_wait_time = default_wait_time if default_wait_time > 0
234
+ default_max_wait_time = get_capybara_wait_time
235
+ @old_wait_time = default_max_wait_time if default_max_wait_time > 0
224
236
  end.()
225
- Capybara.default_wait_time = 0
237
+ Capybara.public_send("#{Wist.wait_time_method}=", 0)
226
238
 
227
239
  begin
228
240
  yield
229
241
  rescue => e
230
242
  raise(e)
231
243
  ensure
232
- Capybara.default_wait_time = @old_wait_time
244
+ Capybara.public_send("#{Wist.wait_time_method}=", @old_wait_time)
233
245
  end
234
246
  end
235
247
 
@@ -39,7 +39,7 @@ class WistTest < CapybaraTestCase
39
39
 
40
40
  wait_until(&wait_until_test(button))
41
41
  # make sure default wait time is back to normal
42
- assert_equal(2, Capybara.default_wait_time)
42
+ assert_equal(2, get_capybara_wait_time)
43
43
  end
44
44
 
45
45
  def test_verify_tweet_button
@@ -193,19 +193,19 @@ class WistTest < CapybaraTestCase
193
193
  end
194
194
 
195
195
  def test_do_instantly
196
- old_time = Capybara.default_wait_time
196
+ old_time = get_capybara_wait_time
197
197
  new_time = nil
198
198
 
199
199
  begin
200
200
  do_instantly do
201
- new_time = Capybara.default_wait_time
201
+ new_time = get_capybara_wait_time
202
202
  raise
203
203
  end
204
204
  rescue
205
205
  end
206
206
 
207
207
  assert_equal(0, new_time)
208
- assert_equal(old_time, Capybara.default_wait_time)
208
+ assert_equal(old_time, get_capybara_wait_time)
209
209
  end
210
210
 
211
211
  def test_interact_with_confirm
data/wist.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'wist'
3
- gem.version = '0.3.1'
3
+ gem.version = '0.4.0'
4
4
  gem.summary = 'capybara helpers'
5
5
  gem.author = 'Lihan Li'
6
6
  gem.email = 'frankieteardrop@gmail.com'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lihan Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-07 00:00:00.000000000 Z
11
+ date: 2015-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara