capybara-screenshot 1.0.22 → 1.0.23

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
- SHA1:
3
- metadata.gz: b82c5c74da4902799ac9a61f9eb37449a928254e
4
- data.tar.gz: 8052ba2b86c41f32539463afeddfe07cb275eb0a
2
+ SHA256:
3
+ metadata.gz: 7b55f70ee082cc747acdd7e056bec35e27a5be9b654f155e3f3919b535832aa9
4
+ data.tar.gz: 691ee47e150ed7d3d15e8f383974dca55dface3c0d977e40afa9a206cbdef37e
5
5
  SHA512:
6
- metadata.gz: 7a4fc4c95398c92bec5387f27521623c2ca6c5d7b6dbf07bfa614e63012ccc31625488baf52b6471bdf6d27e8c5254a0af149e7cb3fc220c4b64ce4239fbdbcf
7
- data.tar.gz: 74fc5fb1271e9d7faaf23271719085ea6302a3b74124d764b1d4f5c6b55109329dfc368e1588466cf99d077a071d4cf77ebe40a8b3f68b140522f2442333f655
6
+ metadata.gz: c87d7ff989030347d1d6b191041d2eaf952f7aab14bc9360cef90cc19ae17537e8e021e49c6b414fc4e0c903097cdd2364a474d872f8a7e379e185b253383b71
7
+ data.tar.gz: 2440f370b61e99ecea4c33ccf2797a5b727105a6d2610ddb11fd63a6fb12ee47eb49a31be6caf847e1207c266076aa6868a52b2a49fc72db7c1cd469f53ad4f2
@@ -4,9 +4,10 @@ rvm:
4
4
  - 2.0.0
5
5
  - 2.1.10
6
6
  - 2.2.10
7
- - 2.3.7
8
- - 2.4.4
9
- - 2.5.1
7
+ - 2.3.8
8
+ - 2.4.6
9
+ - 2.5.5
10
+ - 2.6.2
10
11
  gemfile:
11
12
  - gemfiles/cucumber.1.3.gemfile
12
13
  - gemfiles/cucumber.2.4.gemfile
@@ -1,3 +1,8 @@
1
+ 10 Jun 2019 - 1.0.22 -> 1.0.23
2
+
3
+ * [Support for Capybara sessions implicitly](https://github.com/mattheworiordan/capybara-screenshot/pull/255). Thanks https://github.com/TylerRick
4
+ * [Support for S3 bucket host configuration](https://github.com/mattheworiordan/capybara-screenshot/pull/252). Thanks https://github.com/machty
5
+
1
6
  21 Oct 2018 - 1.0.21 -> 1.0.22
2
7
 
3
8
  * [Support for S3 URL in HTML screenshots](https://github.com/mattheworiordan/capybara-screenshot/pull/239)
data/README.md CHANGED
@@ -5,26 +5,27 @@ capybara-screenshot gem
5
5
  [![Code Climate](https://d3s6mut3hikguw.cloudfront.net/github/mattheworiordan/capybara-screenshot.svg)](https://codeclimate.com/github/mattheworiordan/capybara-screenshot)
6
6
  [![Gem Version](https://badge.fury.io/rb/capybara-screenshot.svg)](http://badge.fury.io/rb/capybara-screenshot)
7
7
 
8
- #### Capture a screen shot for every test failure automatically!
8
+ #### Capture a screenshot for every test failure automatically!
9
9
 
10
- `capybara-screenshot` used with [Capybara](https://github.com/jnicklas/capybara) and [Cucumber](http://cukes.info/), [Rspec](https://www.relishapp.com/rspec) or [Minitest](https://github.com/seattlerb/minitest), will capture a screen shot for each failure in your test suite. The HTML for the failed page, and a screenshot image (when using [capybara-webkit](https://github.com/thoughtbot/capybara-webkit), [Selenium](http://seleniumhq.org/) or [poltergeist](https://github.com/jonleighton/poltergeist)) is saved into `$APPLICATION_ROOT/tmp/capybara`.
10
+ `capybara-screenshot` used with [Capybara](https://github.com/jnicklas/capybara) alongside [Cucumber](http://cukes.info/), [Rspec](https://www.relishapp.com/rspec) or [Minitest](https://github.com/seattlerb/minitest), will capture a screenshot for each failure in your test suite. Associated screenshot and HTML file
11
+ of the failed page (when using [capybara-webkit](https://github.com/thoughtbot/capybara-webkit), [Selenium](http://seleniumhq.org/) or [poltergeist](https://github.com/jonleighton/poltergeist)) is saved into `$APPLICATION_ROOT/tmp/capybara`.
11
12
 
12
- Having screenshots readily available for each test failure is incredibly helpful when trying to quickly diagnose a problem in your failing steps. You can view the source code, and have a screen shot of the page (when applicable), at the time of each failure.
13
+ Available screenshots for each test failure is incredibly helpful for diagnosing problems quickly in your failing steps. You have the ability to view screenshots (when applicable) and source code at the time of each failure.
13
14
 
14
- _Please note that Ruby 1.9+ is required to use this Gem. For Ruby 1.8 support, please see the [capybara-screenshot Ruby 1.8 branch](https://github.com/mattheworiordan/capybara-screenshot/tree/ruby-1.8-support)_
15
+ _Please note that Ruby 1.9+ is required to use this Gem. For Ruby 1.8 support, please see the [capybara-screenshot Ruby 1.8 branch](https://github.com/mattheworiordan/capybara-screenshot/tree/ruby-1.8-support)_
15
16
 
16
17
  Installation
17
18
  -----
18
19
 
19
20
  ### Step 1: install the gem
20
21
 
21
- Using Bundler, add the following to your Gemfile
22
+ Using Bundler, add the following to your Gemfile:
22
23
 
23
24
  ```ruby
24
25
  gem 'capybara-screenshot', :group => :test
25
26
  ```
26
27
 
27
- or install manually using Ruby Gems:
28
+ Alternatively, manually install using Ruby Gems:
28
29
 
29
30
  ```
30
31
  gem install capybara-screenshot
@@ -76,7 +77,7 @@ Typically in 'test/test_helper.rb', please add:
76
77
  require 'capybara-screenshot/testunit'
77
78
  ```
78
79
 
79
- By default, screenshots will be captured for `Test::Unit` tests in the path 'test/integration'. You can add additional paths as:
80
+ By default, screenshots will be captured for `Test::Unit` tests in the path 'test/integration'. You can add additional paths:
80
81
 
81
82
  ```ruby
82
83
  Capybara::Screenshot.testunit_paths << 'test/feature'
@@ -86,27 +87,28 @@ Capybara::Screenshot.testunit_paths << 'test/feature'
86
87
  Manual screenshots
87
88
  ----
88
89
 
89
- If you require more control, you can generate the screenshot on demand rather than on failure. This is useful
90
- if the failure occurs at a point where the screen shot is not as useful for debugging a rendering problem. This
91
- can be more useful if you disable the auto-generate on failure feature with the following config
90
+ If you require more control, screenshots can be generated on demand rather than on failure. This is useful
91
+ when screenshots produced at the time of failure are not as useful for debugging a rendering problem.
92
+ Differentiating between manual and failure screenshots can be improved by disabling the auto-generate on
93
+ failure feature:
92
94
 
93
95
  ```ruby
94
96
  Capybara::Screenshot.autosave_on_failure = false
95
97
  ```
96
98
 
97
- Anywhere the Capybara DSL methods (visit, click etc.) are available so too are the screenshot methods.
99
+ Anywhere the Capybara DSL methods (visit, click etc.) are available so too are the screenshot methods:
98
100
 
99
101
  ```ruby
100
102
  screenshot_and_save_page
101
103
  ```
102
104
 
103
- Or for screenshot only, which will automatically open the image.
105
+ Or for screenshot only, which will automatically open the image:
104
106
 
105
107
  ```ruby
106
108
  screenshot_and_open_image
107
109
  ```
108
110
 
109
- These are just calls on the main library methods.
111
+ These are just calls on the main library methods:
110
112
 
111
113
  ```ruby
112
114
  Capybara::Screenshot.screenshot_and_save_page
@@ -116,7 +118,7 @@ Capybara::Screenshot.screenshot_and_open_image
116
118
  Better looking HTML screenshots
117
119
  -------------------------------
118
120
 
119
- By the default, HTML screenshots will not look very good when opened in a browser. This happens because the browser can't correctly resolve relative paths like `<link href="/assets/...." />`, which stops CSS, images, etc... from beind loaded. To get a nicer looking page, configure Capybara with:
121
+ By the default, HTML screenshots will not look very good when opened in a browser. This happens because the browser can't correctly resolve relative paths like `<link href="/assets/...." />`, which stops CSS, images, etc... from being loaded. To get a nicer looking page, configure Capybara with:
120
122
 
121
123
  ```ruby
122
124
  Capybara.asset_host = 'http://localhost:3000'
@@ -165,7 +167,7 @@ Custom screenshot filename
165
167
  --------------------------
166
168
 
167
169
  If you want to control the screenshot filename for a specific test library, to inject the test name into it for example,
168
- you can override how the basename is generated for the file like so
170
+ you can override how the basename is generated for the file:
169
171
 
170
172
  ```ruby
171
173
  Capybara::Screenshot.register_filename_prefix_formatter(:rspec) do |example|
@@ -173,7 +175,7 @@ Capybara::Screenshot.register_filename_prefix_formatter(:rspec) do |example|
173
175
  end
174
176
  ```
175
177
 
176
- By default capybara-screenshot will append a timestamp to the basename. If you want to disable this behavior set the following option:
178
+ By default capybara-screenshot will append a timestamp to the basename. If you want to disable this behavior, set the following option:
177
179
 
178
180
  ```ruby
179
181
  Capybara::Screenshot.append_timestamp = false
@@ -183,36 +185,25 @@ Capybara::Screenshot.append_timestamp = false
183
185
  Custom screenshot directory
184
186
  --------------------------
185
187
  By default, when running under Rails, Sinatra, and Padrino, screenshots are saved into `$APPLICATION_ROOT/tmp/capybara`. Otherwise, they're saved under `Dir.pwd`.
186
- If you want to customize the location, override the file path as:
188
+ If you want to customize the location, override the file path:
187
189
 
188
190
  ```ruby
189
191
  Capybara.save_path = "/file/path"
190
192
  ```
191
193
 
192
- Usage with multiple Capybara sessions
193
- -------------------------------------
194
-
195
- To make screenshots work with multiple Capybara sessions, replace `Capybara.using_session` with `Capybara.using_session_with_screenshot`:
196
-
197
- ```ruby
198
- Cabybara.using_session_with_screenshot('User 1') do
199
- # screenshots will work and use the correct session
200
- end
201
- ```
202
-
203
194
 
204
195
  Uploading screenshots to S3
205
196
  --------------------------
206
197
  You can configure capybara-screenshot to automatically save your screenshots to an AWS S3 bucket.
207
198
 
208
- First, install the `aws-sdk-s3` gem or add it to your Gemfile
199
+ First, install the `aws-sdk-s3` gem or add it to your Gemfile:
209
200
 
210
201
  ```ruby
211
202
  gem 'aws-sdk-s3', group: :test
212
203
  gem 'capybara-screenshot', group: :test
213
204
  ```
214
205
 
215
- Next, configure capybara-screenshot with your S3 credentials, the bucket to save to, and an optional region (default: `us-east-1`).
206
+ Next, configure capybara-screenshot with your S3 credentials, the bucket to save to, and an optional region (default: `us-east-1`):
216
207
 
217
208
  ```ruby
218
209
  Capybara::Screenshot.s3_configuration = {
@@ -221,10 +212,16 @@ Capybara::Screenshot.s3_configuration = {
221
212
  secret_access_key: "my_secret_access_key",
222
213
  region: "eu-central-1"
223
214
  },
224
- bucket_name: "my_screenshots"
215
+ bucket_name: "my_screenshots",
216
+ # Optionally: Specify the host used to access the uploaded screenshots
217
+ bucket_host: "my_screenshots.s3-eu-central-1.amazonaws.com",
225
218
  }
226
219
  ```
227
220
 
221
+ The access key used for S3 uploads need to have at least the `s3:PutObject` permission.
222
+
223
+ **Note**: If you do not provide the `bucket_host` configuration option, additionally the `s3:GetBucketLocation` permission is required on the bucket for uploads to succeed.
224
+
228
225
  It is also possible to specify the object parameters such as acl.
229
226
  Configure the capybara-screenshot with these options in this way:
230
227
 
@@ -245,7 +242,7 @@ Capybara::Screenshot.s3_configuration = {
245
242
 
246
243
  Pruning old screenshots automatically
247
244
  --------------------------
248
- By default screenshots are saved indefinitely, if you want them to be automatically pruned on a new failure, then you can specify one of the following prune strategies as follows:
245
+ By default, screenshots are saved indefinitely. If you want them to be automatically pruned on a new failure, then you can specify one of the following prune strategies as follows:
249
246
 
250
247
  ```ruby
251
248
  # Keep only the screenshots generated from the last failing test suite
@@ -258,7 +255,7 @@ Capybara::Screenshot.prune_strategy = { keep: 20 }
258
255
  Callbacks
259
256
  ---------
260
257
 
261
- You can hook your own logic into callbacks after the html/screenshot has been saved.
258
+ You can hook your own logic into callbacks after the html/screenshot has been saved:
262
259
 
263
260
  ```ruby
264
261
  # after Saver#save_html
@@ -322,7 +319,7 @@ Please raise an issue at [https://github.com/mattheworiordan/capybara-screenshot
322
319
 
323
320
  #### Contributions
324
321
 
325
- Contributions are welcome. Please fork this gem, and submit a pull request. New features must include test coverage and must pass on all versions of the testing frameworks supported. Run `appraisal` to set up the your Gems. then `appraisal "rake travis:ci"` locally to test your changes against all versions of testing framework gems supported.
322
+ Contributions are welcome. Please fork this gem and then submit a pull request. New features must include test coverage and must pass on all versions of the testing frameworks supported. Run `appraisal` to set up the your Gems. then `appraisal "rake travis:ci"` locally to test your changes against all versions of testing framework gems supported.
326
323
 
327
324
  #### Rubygems
328
325
 
@@ -1,4 +1,20 @@
1
1
  module Capybara
2
+ class << self
3
+ module ScreenshotOverrides
4
+ def using_session(name, &block)
5
+ original_session_name = Capybara.session_name
6
+ Capybara::Screenshot.final_session_name = name
7
+ super(name, &block)
8
+ Capybara::Screenshot.final_session_name = original_session_name
9
+ end
10
+
11
+ # No longer needed. Kept for backwards compatibility only.
12
+ alias_method :using_session_with_screenshot, :using_session
13
+ end
14
+
15
+ prepend ScreenshotOverrides
16
+ end
17
+
2
18
  module DSL
3
19
  # Adds class methods to Capybara module and gets mixed into
4
20
  # the current scope during Cucumber and RSpec tests
@@ -10,15 +26,5 @@ module Capybara
10
26
  def screenshot_and_open_image
11
27
  Capybara::Screenshot.screenshot_and_open_image
12
28
  end
13
-
14
- def using_session_with_screenshot(name,&blk)
15
- original_session_name = Capybara.session_name
16
- Capybara::Screenshot.final_session_name = name
17
- using_session_without_screenshot(name,&blk)
18
- Capybara::Screenshot.final_session_name = original_session_name
19
- end
20
-
21
- alias_method :using_session_without_screenshot, :using_session
22
- alias_method :using_session, :using_session_with_screenshot
23
29
  end
24
30
  end
@@ -11,6 +11,7 @@ module Capybara
11
11
  @saver = saver
12
12
  @s3_client = s3_client
13
13
  @bucket_name = bucket_name
14
+ @bucket_host = options[:bucket_host]
14
15
  @key_prefix = options[:key_prefix]
15
16
  @object_configuration = object_configuration
16
17
  end
@@ -49,9 +50,9 @@ module Capybara
49
50
  object_payload
50
51
  )
51
52
 
52
- s3_region = s3_client.get_bucket_location(bucket: bucket_name).location_constraint
53
+ host = bucket_host || determine_bucket_host
53
54
 
54
- send("#{type}_path=", "https://#{bucket_name}.s3-#{s3_region}.amazonaws.com/#{s3_upload_path}")
55
+ send("#{type}_path=", "https://#{host}/#{s3_upload_path}")
55
56
  end
56
57
  end
57
58
  end
@@ -68,9 +69,18 @@ module Capybara
68
69
  attr_reader :saver,
69
70
  :s3_client,
70
71
  :bucket_name,
72
+ :bucket_host,
71
73
  :object_configuration
72
74
  :key_prefix
73
75
 
76
+ ##
77
+ # Reads the bucket location using a S3 get_bucket_location request.
78
+ # Requires the +s3:GetBucketLocation+ policy.
79
+ def determine_bucket_host
80
+ s3_region = s3_client.get_bucket_location(bucket: bucket_name).location_constraint
81
+ "#{bucket_name}.s3-#{s3_region}.amazonaws.com"
82
+ end
83
+
74
84
  def save_and
75
85
  saver.save
76
86
 
@@ -27,7 +27,9 @@ module Capybara
27
27
 
28
28
  def save
29
29
  current_path do |path|
30
- if !path.empty?
30
+ if path.empty?
31
+ warn 'WARN: Screenshot could not be saved. `page.current_path` is empty.'
32
+ else
31
33
  begin
32
34
  save_html if @html_save
33
35
  rescue StandardError => e
@@ -39,8 +41,6 @@ module Capybara
39
41
  rescue StandardError => e
40
42
  warn "WARN: Screenshot could not be saved. An exception is raised: #{e.inspect}."
41
43
  end
42
- else
43
- warn 'WARN: Screenshot could not be saved. `page.current_path` is empty.'
44
44
  end
45
45
  end
46
46
  end
@@ -49,9 +49,9 @@ module Capybara
49
49
  path = html_path
50
50
  clear_save_path do
51
51
  if Capybara::VERSION.match(/^\d+/)[0] == '1'
52
- capybara.save_page(page.body, "#{path}")
52
+ capybara.save_page(page.body, path.to_s)
53
53
  else
54
- capybara.save_page("#{path}")
54
+ capybara.save_page(path.to_s)
55
55
  end
56
56
  end
57
57
  @html_saved = true
@@ -132,13 +132,15 @@ module Capybara
132
132
  # which('ruby') #=> /usr/bin/ruby
133
133
  def which(cmd)
134
134
  exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
135
+
135
136
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
136
137
  exts.each { |ext|
137
138
  exe = File.join(path, "#{cmd}#{ext}")
138
139
  return exe if File.executable?(exe) && !File.directory?(exe)
139
140
  }
140
141
  end
141
- return nil
142
+
143
+ nil
142
144
  end
143
145
  end
144
146
  end
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Screenshot
3
- VERSION = '1.0.22'
3
+ VERSION = '1.0.23'
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ describe "Using Capybara::Screenshot with Cucumber" do
26
26
 
27
27
  write_file('features/cucumber.feature', code)
28
28
 
29
- run_simple_with_retry cmd, false
29
+ run_simple_with_retry cmd
30
30
 
31
31
  expect(last_command_started.output).to_not match(/failed|failure/i) if options[:assert_all_passed]
32
32
  end
@@ -22,7 +22,7 @@ describe "Using Capybara::Screenshot with MiniTest" do
22
22
  RUBY
23
23
 
24
24
  cmd = 'bundle exec ruby test_failure.rb'
25
- run_simple_with_retry cmd, false
25
+ run_simple_with_retry cmd
26
26
  expect(last_command_started.output).to match %r{Unable to find (visible )?link or button "you'll never find me"}
27
27
  end
28
28
 
@@ -28,7 +28,7 @@ describe "Using Capybara::Screenshot with Test::Unit" do
28
28
  RUBY
29
29
 
30
30
  cmd = "bundle exec ruby #{integration_path}/test_failure.rb"
31
- run_simple_with_retry cmd, false
31
+ run_simple_with_retry cmd
32
32
  expect(last_command_started.output).to match %r{Unable to find (visible )?link or button "you'll never find me"}
33
33
  end
34
34
 
@@ -31,7 +31,7 @@ describe Capybara::Screenshot::RSpec, :type => :aruba do
31
31
  RUBY
32
32
 
33
33
  cmd = cmd_with_format(options[:format])
34
- run_simple_with_retry cmd, false
34
+ run_simple_with_retry cmd
35
35
 
36
36
  expect(last_command_started.output).to match('0 failures') if options[:assert_all_passed]
37
37
  end
@@ -116,7 +116,24 @@ describe Capybara::Screenshot::RSpec, :type => :aruba do
116
116
  end
117
117
  end
118
118
  RUBY
119
- expect('tmp/screenshot.html').to have_file_content(/is/)
119
+ expect('tmp/screenshot.html').to have_file_content(/This is a different page/)
120
+ end
121
+
122
+ it 'saves a screenshot for the correct session for failures Capybara.using_session' do
123
+ run_failing_case <<-RUBY, %r{Unable to find (visible )?link or button "you'll never find me"}
124
+ feature 'screenshot with failure' do
125
+ scenario 'click on a missing link' do
126
+ visit '/'
127
+ expect(page.body).to include('This is the root page')
128
+ Capybara.using_session :different_session do
129
+ visit '/different_page'
130
+ expect(page.body).to include('This is a different page')
131
+ click_on "you'll never find me"
132
+ end
133
+ end
134
+ end
135
+ RUBY
136
+ expect('tmp/screenshot.html').to have_file_content(/This is a different page/)
120
137
  end
121
138
 
122
139
  context 'pruning' do
@@ -12,7 +12,7 @@ describe "Using Capybara::Screenshot with Spinach" do
12
12
 
13
13
  write_file('spinach.feature', code)
14
14
  cmd = 'bundle exec spinach -f .'
15
- run_simple_with_retry cmd, false
15
+ run_simple_with_retry cmd
16
16
  expect(last_command_started.output).to match(failure_message)
17
17
  end
18
18
 
@@ -41,11 +41,11 @@ module CommonSetup
41
41
  end
42
42
  end
43
43
 
44
- def run_simple_with_retry(*args)
45
- run_simple(*args)
44
+ def run_simple_with_retry(cmd, fail_on_error: false)
45
+ run_command_and_stop(cmd, fail_on_error: fail_on_error)
46
46
  rescue ChildProcess::TimeoutError => e
47
- puts "run_simple(#{args.join(', ')}) failed. Will retry once. `#{e.message}`"
48
- run_simple(*args)
47
+ puts "run_command_and_stop(#{cmd}, fail_on_error: #{fail_on_error}) failed. Will retry once. `#{e.message}`"
48
+ run_command_and_stop(cmd, fail_on_error: fail_on_error)
49
49
  end
50
50
 
51
51
  def configure_prune_strategy(strategy)
@@ -26,6 +26,19 @@ describe Capybara do
26
26
  }.to raise_exception ::RSpec::Expectations::ExpectationNotMetError
27
27
  end
28
28
  end
29
+
30
+ describe 'Capybara.using_session' do
31
+ include Capybara::DSL
32
+
33
+ it 'saves the name of the final session' do
34
+ expect(Capybara::Screenshot).to receive(:final_session_name=).with(:different_session)
35
+ expect {
36
+ Capybara.using_session :different_session do
37
+ expect(0).to eq 1
38
+ end
39
+ }.to raise_exception ::RSpec::Expectations::ExpectationNotMetError
40
+ end
41
+ end
29
42
  end
30
43
 
31
44
  describe 'final_session_name' do
@@ -5,10 +5,11 @@ describe Capybara::Screenshot::S3Saver do
5
5
  let(:saver) { double('saver') }
6
6
  let(:bucket_name) { double('bucket_name') }
7
7
  let(:s3_object_configuration) { {} }
8
+ let(:options) { {} }
8
9
  let(:s3_client) { double('s3_client') }
9
10
  let(:key_prefix){ "some/path/" }
10
11
 
11
- let(:s3_saver) { described_class.new(saver, s3_client, bucket_name, s3_object_configuration) }
12
+ let(:s3_saver) { described_class.new(saver, s3_client, bucket_name, s3_object_configuration, options) }
12
13
  let(:s3_saver_with_key_prefix) { described_class.new(saver, s3_client, bucket_name, s3_object_configuration, key_prefix: key_prefix) }
13
14
 
14
15
  let(:region) { double('region') }
@@ -104,6 +105,20 @@ describe Capybara::Screenshot::S3Saver do
104
105
  allow(saver).to receive(:save)
105
106
  end
106
107
 
108
+ context 'providing a bucket_host' do
109
+ let(:options) { { bucket_host: 'some other location' } }
110
+
111
+ it 'does not request the bucket location' do
112
+ screenshot_path = '/baz/bim.jpg'
113
+
114
+ screenshot_file = double('screenshot_file')
115
+
116
+ expect(s3_saver).not_to receive(:determine_bucket_host)
117
+
118
+ s3_saver.save
119
+ end
120
+ end
121
+
107
122
  it 'calls save on the underlying saver' do
108
123
  expect(saver).to receive(:save)
109
124
 
@@ -125,6 +140,8 @@ describe Capybara::Screenshot::S3Saver do
125
140
  body: html_file
126
141
  )
127
142
 
143
+ expect(s3_saver).to receive(:determine_bucket_host).and_call_original
144
+
128
145
  s3_saver.save
129
146
  end
130
147
 
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.22
4
+ version: 1.0.23
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: 2018-10-21 00:00:00.000000000 Z
11
+ date: 2019-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -256,8 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  - !ruby/object:Gem::Version
257
257
  version: '0'
258
258
  requirements: []
259
- rubyforge_project: capybara-screenshot
260
- rubygems_version: 2.4.8
259
+ rubygems_version: 3.0.3
261
260
  signing_key:
262
261
  specification_version: 4
263
262
  summary: Automatically create snapshots when Cucumber steps fail with Capybara and