leifcr-capybara-screenshot 1.0.15 → 1.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capybara-screenshot.rb +1 -1
- data/lib/capybara-screenshot/version.rb +1 -1
- data/spec/unit/saver_spec.rb +24 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b17842c7a2995b2512122a0664dc711a9835cbdb
|
4
|
+
data.tar.gz: 24c6e595eb4b0dbb84ce991c8a4fd6236c82ff5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec01472dd136aa3059b6ccbe4ecb1e11e84a30600e68c27d467c8550e3cfba8b4a58b4c2c960068f97fcbf5d3828309dff90f6e8cf73258fad5e67f2080170bc
|
7
|
+
data.tar.gz: aaedf4ce015797c77f383740bac20333184b547d12d4e25704dbcfec89cd4598cdfa7cf9b6914aa24bb40d79368fc9dcc5b45d56c6e0cb775659ec8e4ed2a485
|
data/lib/capybara-screenshot.rb
CHANGED
@@ -58,7 +58,7 @@ module Capybara
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def self.capybara_alt_root
|
61
|
-
@capybara_alt_root ||= if
|
61
|
+
@capybara_alt_root ||= if alternative_root.length >0
|
62
62
|
alternative_root
|
63
63
|
elsif defined?(::Rails) && ::Rails.root.present?
|
64
64
|
::Rails.root.join capybara_tmp_path
|
data/spec/unit/saver_spec.rb
CHANGED
@@ -144,8 +144,8 @@ describe Capybara::Screenshot::Saver do
|
|
144
144
|
let(:saver) { Capybara::Screenshot::Saver.new(capybara_mock, page_mock) }
|
145
145
|
|
146
146
|
before do
|
147
|
-
allow(saver).to receive(:
|
148
|
-
allow(saver).to receive(:
|
147
|
+
allow(saver).to receive(:html_path_alt_root) { 'page.html' }
|
148
|
+
allow(saver).to receive(:screenshot_path_alt_root) { 'screenshot.png' }
|
149
149
|
end
|
150
150
|
|
151
151
|
it 'outputs the path for the HTML screenshot' do
|
@@ -161,6 +161,28 @@ describe Capybara::Screenshot::Saver do
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
+
describe '#output_screenshot_path with alternative path' do
|
165
|
+
let(:saver) { Capybara::Screenshot::Saver.new(capybara_mock, page_mock) }
|
166
|
+
|
167
|
+
before do
|
168
|
+
Capybara::Screenshot.alternative_root = '/tmp/joik/'
|
169
|
+
Capybara::Screenshot.append_timestamp = false
|
170
|
+
Capybara::Screenshot.append_random = false
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'outputs the path for the HTML screenshot' do
|
174
|
+
allow(saver).to receive(:html_saved?).and_return(true)
|
175
|
+
expect(saver).to receive(:output).with("HTML screenshot: /tmp/joik/screenshot.html")
|
176
|
+
saver.output_screenshot_path
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'outputs the path for the Image screenshot' do
|
180
|
+
allow(saver).to receive(:screenshot_saved?).and_return(true)
|
181
|
+
expect(saver).to receive(:output).with("Image screenshot: /tmp/joik/screenshot.png")
|
182
|
+
saver.output_screenshot_path
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
164
186
|
describe 'callbacks' do
|
165
187
|
let(:saver) { Capybara::Screenshot::Saver.new(capybara_mock, page_mock) }
|
166
188
|
|