File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,7 @@ def initialize(app, options = {})
32
32
33
33
@screen_size = @options . delete ( :screen_size )
34
34
@screen_size ||= DEFAULT_MAXIMIZE_SCREEN_SIZE
35
-
36
- @options [ :save_path ] = File . expand_path ( Capybara . save_path ) if Capybara . save_path
35
+ @options [ :save_path ] ||= File . expand_path ( Capybara . save_path ) if Capybara . save_path
37
36
38
37
ENV [ "FERRUM_DEBUG" ] = "true" if ENV [ "CUPRITE_DEBUG" ]
39
38
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ describe Capybara ::Cuprite ::Driver do
4
+ describe "save_path configuration" do
5
+ it "defaults to the Capybara save path" do
6
+ driver = with_capybara_save_path ( "/tmp/capybara-save-path" ) do
7
+ described_class . new ( nil )
8
+ end
9
+
10
+ expect ( driver . browser . options ) . to include ( save_path : "/tmp/capybara-save-path" )
11
+ end
12
+
13
+ it "allows a custom path to be specified" do
14
+ custom_path = Dir . mktmpdir
15
+
16
+ driver = with_capybara_save_path ( "/tmp/capybara-save-path" ) do
17
+ described_class . new ( nil , { save_path : custom_path } )
18
+ end
19
+
20
+ expect ( driver . browser . options ) . to include ( save_path : custom_path )
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def with_capybara_save_path ( path )
27
+ original_capybara_save_path = Capybara . save_path
28
+ Capybara . save_path = path
29
+ yield
30
+ ensure
31
+ Capybara . save_path = original_capybara_save_path
32
+ end
33
+ end
You can’t perform that action at this time.
0 commit comments