wist 0.2.0 → 0.2.1

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: 0cc764cb16ae3e69fbd83e69683b71f3376624ef
4
- data.tar.gz: e3cec4ee9c95beca47ff8998ed9d711deb2820c2
3
+ metadata.gz: cc61f2c9e1bbd38709007f5da04f7245ecbb7eea
4
+ data.tar.gz: 73d64f0a71e5cc0e23ad92a03123a8054d0ff140
5
5
  SHA512:
6
- metadata.gz: 1c2162229c88a9cc9edf5258fbf7393066e9ec6bb5a1e8bf9c5503251d27687aab33dda8acda3dff39e5332380763f9bfc75fc21a00e42aeb00757132e16b48b
7
- data.tar.gz: 5ac8dd9a14280305772a95e88f6388564857f5551a2cbf20b791ec07246abfeae35c030cb8050a7afc2f9b1734abe9c4fbf59a76167ce657c39dbc034f566116
6
+ metadata.gz: 924060310a5fc0beaaeb89e75306d2c254e439126bd09f6d849d832d8f586510532ac8b8c9f2096e2244e1603c080acae08c7087b7cec7a3b36e6412ca52f2d1
7
+ data.tar.gz: 861deace2eeea2ccbb7a3686f86160064fa855ca26c1ccdd11d268f9347910dff50529737776adf0ee0864d798acca4eaa54ba2140303792ff98a867105af9b6
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- wist (0.2.0)
12
+ wist (0.2.1)
13
13
  capybara
14
14
  selenium-webdriver
15
15
 
data/lib/wist.rb CHANGED
@@ -15,9 +15,9 @@ module Wist
15
15
  end
16
16
  end
17
17
 
18
- def wait_until(timeout: Capybara.default_wait_time)
18
+ def wait_until(timeout: false)
19
19
  do_instantly do
20
- Selenium::WebDriver::Wait.new(timeout: timeout).until do
20
+ Selenium::WebDriver::Wait.new(timeout: timeout || @old_wait_time).until do
21
21
  begin
22
22
  yield
23
23
  rescue
@@ -171,7 +171,10 @@ module Wist
171
171
  end
172
172
 
173
173
  def do_instantly
174
- old_time = Capybara.default_wait_time
174
+ lambda do
175
+ default_wait_time = Capybara.default_wait_time
176
+ @old_wait_time = default_wait_time if default_wait_time > 0
177
+ end.()
175
178
  Capybara.default_wait_time = 0
176
179
 
177
180
  begin
@@ -179,7 +182,7 @@ module Wist
179
182
  rescue => e
180
183
  raise(e)
181
184
  ensure
182
- Capybara.default_wait_time = old_time
185
+ Capybara.default_wait_time = @old_wait_time
183
186
  end
184
187
  end
185
188
  end
data/test/test.css CHANGED
@@ -1,3 +1,3 @@
1
1
  #test_scroll_to {
2
- margin-top: 1000px;
2
+ margin-top: 5000px;
3
3
  }
@@ -10,22 +10,34 @@ class WistTest < CapybaraTestCase
10
10
  assert current_path.match(/test#{num}.html$/)
11
11
  end
12
12
 
13
+ def wait_until_test(button)
14
+ lambda do
15
+ raise unless button.text == 'clicked'
16
+ true
17
+ end
18
+ end
19
+
13
20
  # tests
14
21
  def test_click
15
22
  click '#click_test'
16
23
  assert_equal 'clicked', find('#click_test').text
17
24
  end
18
25
 
19
- def test_wait_until
26
+ def test_wait_until_nested
20
27
  button = find('#wait_test')
21
28
  button.click
22
- assert button.text != 'clicked'
23
29
 
24
30
  wait_until do
25
- raise unless button.text == 'clicked'
26
- true
31
+ wait_until(&wait_until_test(button))
27
32
  end
33
+ end
34
+
35
+ def test_wait_until
36
+ button = find('#wait_test')
37
+ button.click
38
+ assert(button.text != 'clicked')
28
39
 
40
+ wait_until(&wait_until_test(button))
29
41
  # make sure default wait time is back to normal
30
42
  assert_equal(2, Capybara.default_wait_time)
31
43
  end
data/wist.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'wist'
3
- gem.version = '0.2.0'
3
+ gem.version = '0.2.1'
4
4
  gem.summary = 'capybara helpers'
5
5
  gem.author = 'Lihan Li'
6
6
  gem.email = 'frankieteardrop@gmail.com'
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lihan Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-08 00:00:00.000000000 Z
11
+ date: 2014-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
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: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description:
@@ -44,7 +44,7 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
- - ".gitignore"
47
+ - .gitignore
48
48
  - Gemfile
49
49
  - Gemfile.lock
50
50
  - MIT-LICENSE
@@ -70,18 +70,26 @@ require_paths:
70
70
  - lib
71
71
  required_ruby_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - ">="
78
+ - - '>='
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.2.2
83
+ rubygems_version: 2.0.14
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: capybara helpers
87
- test_files: []
87
+ test_files:
88
+ - test/jquery.cookie.js
89
+ - test/jquery.js
90
+ - test/test.css
91
+ - test/test.js
92
+ - test/test0.html
93
+ - test/test1.html
94
+ - test/test_helper.rb
95
+ - test/tests/wist_test.rb