capybara-screenshot 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +6 -0
- data/lib/capybara-screenshot.rb +8 -5
- data/lib/capybara-screenshot/pruner.rb +3 -3
- data/lib/capybara-screenshot/saver.rb +1 -0
- data/lib/capybara-screenshot/version.rb +1 -1
- data/spec/unit/saver_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDM5NDRiYWIwNmRkY2JkMWFiMjRkNWUzYjE1YTUwZWY3NmE5MmY4NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTMwNTdiZWE1ZGU5NjMyZDVjZjM0ZTQyZGJmMjJjNDY3Y2VjZTQ5ZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDhmNDQ2YTA3MTkwZWNlM2JhZmI5MDdhZjA1ZTNlNWI2OTA1MDYxODVmNjVi
|
10
|
+
ZDJjZmI3YTZmZmEzMmZmYjRiODdlODljZDQ1NjM3YzQ2ZTIxMmU1YTJkNDhj
|
11
|
+
ODk1OGUxYWVlYjQwZDcyYWVmZmFmOWQxMTQ5MWYzYzZmY2ZmYjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTQ5ZjZjMjkxZTg3MmU1YzJiYzViN2M5OWNlMjU4NGM1ODhmODlkNGE2NTJi
|
14
|
+
OWFhN2VhNzYyMDJiY2FiYTgxYjhjZjE1NmYyNTU5NzA4NmViZTQwYzUwMmRh
|
15
|
+
ZGE3ZDNhYWU0OThlMDMxM2FjZmNiZGZhZjdkNzgyZTM4ZWFiOTc=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
29 June 2015 - 1.0.9 -> 1.0.10
|
2
|
+
|
3
|
+
* [Small fix to memoization](https://github.com/mattheworiordan/capybara-screenshot/pull/134) plus [mini refactor](https://github.com/mattheworiordan/capybara-screenshot/commit/1db950bc53c729b26b8881d058a8781d6e7611b8)
|
4
|
+
|
5
|
+
Thanks to [Systho](https://github.com/Systho)
|
6
|
+
|
1
7
|
6 April 2015 - 1.0.8 -> 1.0.9
|
2
8
|
-----------
|
3
9
|
|
data/lib/capybara-screenshot.rb
CHANGED
@@ -52,11 +52,7 @@ module Capybara
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.capybara_root
|
55
|
-
|
56
|
-
#If the path isn't set, default to the current directory
|
57
|
-
capybara_tmp_path = Capybara.save_and_open_page_path || '.'
|
58
|
-
|
59
|
-
@capybara = if defined?(::Rails)
|
55
|
+
@capybara_root ||= if defined?(::Rails)
|
60
56
|
::Rails.root.join capybara_tmp_path
|
61
57
|
elsif defined?(Padrino)
|
62
58
|
Padrino.root capybara_tmp_path
|
@@ -91,6 +87,13 @@ module Capybara
|
|
91
87
|
def self.reset_prune_history
|
92
88
|
@pruned_previous_screenshots = nil
|
93
89
|
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
# If the path isn't set, default to the current directory
|
94
|
+
def self.capybara_tmp_path
|
95
|
+
Capybara.save_and_open_page_path || '.'
|
96
|
+
end
|
94
97
|
end
|
95
98
|
end
|
96
99
|
|
@@ -8,13 +8,13 @@ module Capybara
|
|
8
8
|
|
9
9
|
@strategy_proc = case strategy
|
10
10
|
when :keep_all
|
11
|
-
|
11
|
+
lambda { }
|
12
12
|
when :keep_last_run
|
13
|
-
|
13
|
+
lambda { prune_with_last_run_strategy }
|
14
14
|
when Hash
|
15
15
|
raise ArgumentError, ":keep key is required" unless strategy[:keep]
|
16
16
|
raise ArgumentError, ":keep value must be number greater than zero" unless strategy[:keep].to_i > 0
|
17
|
-
|
17
|
+
lambda { prune_with_numeric_strategy(strategy[:keep].to_i) }
|
18
18
|
else
|
19
19
|
fail "Invalid prune strategy #{strategy}. `:keep_all`or `{ keep: 10 }` are valid examples."
|
20
20
|
end
|
data/spec/unit/saver_spec.rb
CHANGED
@@ -119,6 +119,20 @@ describe Capybara::Screenshot::Saver do
|
|
119
119
|
expect(saver).to_not be_html_saved
|
120
120
|
end
|
121
121
|
|
122
|
+
context 'when saving a screenshot fails' do
|
123
|
+
it 'still restores the original value of Capybara.save_and_open_page_path' do
|
124
|
+
Capybara.save_and_open_page_path = 'tmp/bananas'
|
125
|
+
|
126
|
+
expect(capybara_mock).to receive(:save_page).and_raise
|
127
|
+
|
128
|
+
expect {
|
129
|
+
saver.save
|
130
|
+
}.to raise_error
|
131
|
+
|
132
|
+
expect(Capybara.save_and_open_page_path).to eq('tmp/bananas')
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
122
136
|
describe '#output_screenshot_path' do
|
123
137
|
let(:saver) { Capybara::Screenshot::Saver.new(capybara_mock, page_mock) }
|
124
138
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-screenshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew O'Riordan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|