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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2055c8c34096e3290fa3a825653f2899259aaeb5
4
- data.tar.gz: 8bd41a0f9327e22c0c00f05a97e1f6312896459b
3
+ metadata.gz: b17842c7a2995b2512122a0664dc711a9835cbdb
4
+ data.tar.gz: 24c6e595eb4b0dbb84ce991c8a4fd6236c82ff5c
5
5
  SHA512:
6
- metadata.gz: 04b230999d35973d596d03f347be9d6ec723a62c1e96d0d531be4631cae57c2e60bb698fca68fae09db34affcf6ac527ba32890df97998b6450127161f3b4231
7
- data.tar.gz: 9b3f74ea94871096f492466fc2d9e1adf09c9fdbe30fe4b683feaa3e9562f08dbd732b5a3559dbffd09985ee4c60b4963427e8421334e4ec783b561a6066a9d6
6
+ metadata.gz: ec01472dd136aa3059b6ccbe4ecb1e11e84a30600e68c27d467c8550e3cfba8b4a58b4c2c960068f97fcbf5d3828309dff90f6e8cf73258fad5e67f2080170bc
7
+ data.tar.gz: aaedf4ce015797c77f383740bac20333184b547d12d4e25704dbcfec89cd4598cdfa7cf9b6914aa24bb40d79368fc9dcc5b45d56c6e0cb775659ec8e4ed2a485
@@ -58,7 +58,7 @@ module Capybara
58
58
  end
59
59
 
60
60
  def self.capybara_alt_root
61
- @capybara_alt_root ||= if !alternative_root.blank?
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
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Screenshot
3
- VERSION = '1.0.15'
3
+ VERSION = '1.0.16'
4
4
  end
5
5
  end
@@ -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(:html_path) { 'page.html' }
148
- allow(saver).to receive(:screenshot_path) { 'screenshot.png' }
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leifcr-capybara-screenshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew O'Riordan