waterpig 0.9.2 → 0.9.3
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 +4 -4
- data/lib/waterpig/at_exit_duck_punch.rb +33 -0
- data/lib/waterpig/browser-size.rb +22 -1
- data/spec/embarrassing.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a9c11834b4217885829979fea038543cd198083
|
4
|
+
data.tar.gz: eef4f7e90c5db5a7e14539f463b33054522b955a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e34939aa6c2b4764947689c71305af995f344352db8034e0b9f646ddd7d53682bacfa073fe55dff0c8679c820f609579d269cdef11330885a1cdb5587454c18e
|
7
|
+
data.tar.gz: 2706da25526fb916a4da589761954d58a39243fbac818583b65971e0a4cefd75e17a81d5ea776ca3af64fdf778e79ef8eeb47e9545bb94bd6a95018920354276
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# This file is present to use in difficult RSpec cases.
|
2
|
+
#
|
3
|
+
# Essentially, an at_exit block will fail for some reason. The symptom is that
|
4
|
+
# RSpec doesn't exit, or exits with the wrong status code. To determine where
|
5
|
+
# the issue might be, run
|
6
|
+
#
|
7
|
+
# rspec -r waterpig/at_exit_duck_punch spec
|
8
|
+
#
|
9
|
+
# which will then report all the at_exit blocks as they're declared and when
|
10
|
+
# they're run
|
11
|
+
module Kernel
|
12
|
+
alias original_at_exit at_exit
|
13
|
+
|
14
|
+
def at_exit(&block)
|
15
|
+
installing_pid = Process.pid
|
16
|
+
install_point = caller[0]
|
17
|
+
$stderr.puts "at_exit installed at #{install_point}"
|
18
|
+
|
19
|
+
original_at_exit do
|
20
|
+
$stderr.puts "START: at_exit block by pid: #{installing_pid} run in #{Process.pid} from #{install_point}"
|
21
|
+
if $!
|
22
|
+
$stderr.puts "current $!: #{$!.inspect}"
|
23
|
+
end
|
24
|
+
|
25
|
+
block.call
|
26
|
+
|
27
|
+
$stderr.puts "FINISH: at_exit block from #{install_point}"
|
28
|
+
if $!
|
29
|
+
$stderr.puts "current $!: #{$!.inspect}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -7,8 +7,29 @@ module Waterpig
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
#empirically determined - there's an issue on Chrome somewhere, but I can't
|
11
|
+
#find it at the moment. The upshot is: if you resize Chrome on Linux below
|
12
|
+
#this width, the content area collapses to 0 height. Tests pass anyway, is
|
13
|
+
#the worst part.
|
14
|
+
MIN_WIDTH = 348
|
15
|
+
|
16
|
+
@@warned_about_size = false
|
17
|
+
|
10
18
|
def self.resize_browser_window(size)
|
11
|
-
Capybara.current_session.driver
|
19
|
+
driver = Capybara.current_session.driver
|
20
|
+
window = driver.current_window_handle
|
21
|
+
width = size.fetch(:width)
|
22
|
+
if width < MIN_WIDTH
|
23
|
+
unless @@warned_about_size
|
24
|
+
warn "Requested browser size #{size.inspect} - but minimum width is #{MIN_WIDTH}. Adjusting."
|
25
|
+
warn "You might consider setting up mobile browser emulation. (details forthcoming)"
|
26
|
+
@@warned_about_size = true
|
27
|
+
end
|
28
|
+
width = MIN_WIDTH
|
29
|
+
end
|
30
|
+
|
31
|
+
req_size = [width, size.fetch(:height)]
|
32
|
+
driver.resize_window_to(window, *req_size)
|
12
33
|
end
|
13
34
|
|
14
35
|
def self.current_size(example)
|
data/spec/embarrassing.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waterpig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Judson Lester
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capybara
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/waterpig/snap-step.rb
|
93
93
|
- lib/waterpig/browser-tools.rb
|
94
94
|
- lib/waterpig/browser-size.rb
|
95
|
+
- lib/waterpig/at_exit_duck_punch.rb
|
95
96
|
- spec/embarrassing.rb
|
96
97
|
- spec_help/spec_helper.rb
|
97
98
|
- spec_help/gem_test_suite.rb
|
@@ -105,7 +106,7 @@ rdoc_options:
|
|
105
106
|
- --main
|
106
107
|
- doc/README
|
107
108
|
- --title
|
108
|
-
- waterpig-0.9.
|
109
|
+
- waterpig-0.9.3 Documentation
|
109
110
|
require_paths:
|
110
111
|
- lib/
|
111
112
|
required_ruby_version: !ruby/object:Gem::Requirement
|