capybara-screenshot 1.0.13 → 1.0.14

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: a2c4277a621182718153bba9b9bae60234ddfd17
4
- data.tar.gz: 6af401d8ae56c2849916c0145f0f0ce928cc92ac
3
+ metadata.gz: 71470cade862f24352d34e3d61d3e1d6e53ede52
4
+ data.tar.gz: abbee3986bf463c8b26526337255ec8397b2757d
5
5
  SHA512:
6
- metadata.gz: 0696563bcf86da3827f2d8392f2555c56e2f830b0ff6c76bad72d5ac2c1b8ddb37730fee26c51924dbd0f4edc4cf8054949adac7506bf01b45cd955fc200c676
7
- data.tar.gz: 55ebe3341f404a7c57d5265ca6478127e3b3b4f277a0f2d130f87d5724b0d38d6d441fed4488ab13d0194826432ad0491f6a52b754dc19e578f6f33f61be1a83
6
+ metadata.gz: 6540046700e726903a13951d1fc8776da24d9db19a0096e65a3009404f66c3aea364727421b629a0292364d54bb19c207322694b198fcf52c3e64ca30019473b
7
+ data.tar.gz: b7c37d742286182baa7c97d767a12a0c162e465c32338e19407c02a70159046682cb7233bcdba7763b7923a0315b844bdc73792272ffcbecfb02a97eee393dc2
@@ -1,18 +1,13 @@
1
1
  language: ruby
2
2
  script: "rake travis:ci"
3
3
  rvm:
4
- - 1.9.3
5
4
  - 2.0.0
6
- - 2.1.2
5
+ - 2.1.10
7
6
  - 2.2.1
8
- - jruby-19mode
9
- - jruby-1.7.13
7
+ - 2.3.1
10
8
  gemfile:
11
- - gemfiles/cucumber.1.2.gemfile
12
- - gemfiles/cucumber.1.3.0.gemfile
9
+ - gemfiles/cucumber.1.3.gemfile
10
+ - gemfiles/cucumber.2.4.gemfile
13
11
  - gemfiles/latest.gemfile
14
- - gemfiles/rspec.2.14.gemfile
15
- - gemfiles/rspec.2.99.gemfile
16
12
  - gemfiles/rspec.3.0.gemfile
17
- - gemfiles/spinach.0.7.gemfile
18
- - gemfiles/spinach.0.8.0.gemfile
13
+ - gemfiles/spinach.0.8.gemfile
data/Appraisals CHANGED
@@ -1,29 +1,17 @@
1
- appraise "rspec.2.14" do
2
- gem "rspec", "2.14"
3
- end
4
-
5
- appraise "rspec.2.99" do
6
- gem "rspec", "2.99"
7
- end
8
-
9
1
  appraise "rspec.3.0" do
10
2
  gem "rspec", "3.0"
11
3
  end
12
4
 
13
- appraise "cucumber.1.2" do
14
- gem "cucumber", "1.2"
15
- end
16
-
17
- appraise "cucumber.1.3.0" do
18
- gem "cucumber", "1.3.0"
5
+ appraise "cucumber.1.3" do
6
+ gem "cucumber", "~>1.3.0"
19
7
  end
20
8
 
21
- appraise "spinach.0.7" do
22
- gem "spinach", "0.7"
9
+ appraise "cucumber.2.4" do
10
+ gem "cucumber", "~>2.4.0"
23
11
  end
24
12
 
25
- appraise "spinach.0.8.0" do
26
- gem "spinach", "0.8.0"
13
+ appraise "spinach.0.8" do
14
+ gem "spinach", "~>0.8.0"
27
15
  end
28
16
 
29
17
  appraise "latest" do
@@ -1,3 +1,10 @@
1
+ 15 Sep 2016 - 1.0.13 -> 1.0.14
2
+
3
+ * CI stable again - dropped CI support for older versions of Ruby and JRuby. It is just too painful and there is no evidence that our users need this or that Capybara Screenshot is indeed broken. It is better to have a reliable build system so that PRs can get merged in reliably and easily.
4
+ * Fixed an inconsistency in the use of `save_and_open_page_path`
5
+ * Improved debugging of Aruba tests so that contributors can easily understand why their builds break
6
+ * Path fixes thanks to [Ryan McGarvey](https://github.com/ryanmcgarvey)
7
+
1
8
  23 May 2016 - 1.0.12 -> 1.0.13
2
9
 
3
10
  * Fixes [mkmf bug 162](https://github.com/mattheworiordan/capybara-screenshot/issues/162) and [mkmf bug 174](https://github.com/mattheworiordan/capybara-screenshot/issues/174)
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in capybara-screenshot.gemspec
4
4
  gemspec
5
5
 
6
- gem 'rake'
7
- gem 'appraisal'
8
- gem 'aruba', '~> 0.14.0'
6
+ gem 'rack', '~> 1.0'
7
+ gem 'rake', '~> 10.0'
8
+ gem 'appraisal', '~> 2.0'
9
+ gem 'aruba', '~> 0.14.0'
data/README.md CHANGED
@@ -170,13 +170,13 @@ By default, when running under Rails, Sinatra, and Padrino, screenshots are save
170
170
  If you want to customize the location, override the file path as:
171
171
 
172
172
  ```ruby
173
- Capybara.save_and_open_page_path = "/file/path"
173
+ Capybara.save_path = "/file/path"
174
174
  ```
175
175
 
176
176
 
177
177
  Uploading screenshots to S3
178
178
  --------------------------
179
- You can configure capybara-screenshot to automatically save your screenshots to an AWS S3 bucket.
179
+ You can configure capybara-screenshot to automatically save your screenshots to an AWS S3 bucket.
180
180
 
181
181
  First, install the `aws-sdk` gem or add it to your Gemfile
182
182
 
@@ -185,7 +185,7 @@ gem 'capybara-screenshot', :group => :test
185
185
  gem 'aws-sdk', :group => :test
186
186
  ```
187
187
 
188
- Next, configure capybara-screenshot with your S3 credentials, the bucket to save to, and an optional region (default: `us-east-1`).
188
+ Next, configure capybara-screenshot with your S3 credentials, the bucket to save to, and an optional region (default: `us-east-1`).
189
189
 
190
190
  ```ruby
191
191
  Capybara::Screenshot.s3_configuration = {
@@ -254,7 +254,7 @@ Please raise an issue at [https://github.com/mattheworiordan/capybara-screenshot
254
254
 
255
255
  #### Contributions
256
256
 
257
- 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 "bundle exec rspec && bundle exec cucumber"` locally to test your changes against all versions of testing framework gems supported.
257
+ 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.
258
258
 
259
259
  #### Rubygems
260
260
 
@@ -272,4 +272,4 @@ This gem was written by **Matthew O'Riordan**, with contributions from [many kin
272
272
  License
273
273
  -------
274
274
 
275
- Copyright © 2014 Matthew O'Riordan, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.
275
+ Copyright © 2016 Matthew O'Riordan, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rack", "~> 1.0"
6
+ gem "rake", "~> 10.0"
7
+ gem "appraisal", "~> 2.0"
8
+ gem "aruba", "~> 0.14.0"
9
+ gem "cucumber", "~>1.3.0"
10
+
11
+ gemspec :path => "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rack", "~> 1.0"
6
+ gem "rake", "~> 10.0"
7
+ gem "appraisal", "~> 2.0"
8
+ gem "aruba", "~> 0.14.0"
9
+ gem "cucumber", "~>2.4.0"
10
+
11
+ gemspec :path => "../"
@@ -2,7 +2,9 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rake"
6
- gem "appraisal"
5
+ gem "rack", "~> 1.0"
6
+ gem "rake", "~> 10.0"
7
+ gem "appraisal", "~> 2.0"
8
+ gem "aruba", "~> 0.14.0"
7
9
 
8
10
  gemspec :path => "../"
@@ -2,8 +2,10 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rake"
6
- gem "appraisal"
5
+ gem "rack", "~> 1.0"
6
+ gem "rake", "~> 10.0"
7
+ gem "appraisal", "~> 2.0"
8
+ gem "aruba", "~> 0.14.0"
7
9
  gem "rspec", "3.0"
8
10
 
9
11
  gemspec :path => "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rack", "~> 1.0"
6
+ gem "rake", "~> 10.0"
7
+ gem "appraisal", "~> 2.0"
8
+ gem "aruba", "~> 0.14.0"
9
+ gem "spinach", "~>0.8.0"
10
+
11
+ gemspec :path => "../"
@@ -115,6 +115,19 @@ module Capybara
115
115
  Capybara.save_and_open_page_path
116
116
  end || '.'
117
117
  end
118
+
119
+ # Configure the path unless '.'
120
+ def self.capybara_tmp_path=(path)
121
+ return if path == '.'
122
+
123
+ # `#save_and_open_page_path` is deprecated
124
+ # https://github.com/jnicklas/capybara/blob/48ab1ede946dec2250a2d1d8cbb3313f25096456/History.md#L37
125
+ if Capybara.respond_to?(:save_path)
126
+ Capybara.save_path = path
127
+ else
128
+ Capybara.save_and_open_page_path = path
129
+ end
130
+ end
118
131
  end
119
132
  end
120
133
 
@@ -13,6 +13,7 @@ module Capybara
13
13
  lambda { prune_with_last_run_strategy }
14
14
  when Hash
15
15
  raise ArgumentError, ":keep key is required" unless strategy[:keep]
16
+ raise ArgumentError, ":keep must be a Integer" unless strategy[:keep].kind_of?(Integer)
16
17
  raise ArgumentError, ":keep value must be number greater than zero" unless strategy[:keep].to_i > 0
17
18
  lambda { prune_with_numeric_strategy(strategy[:keep].to_i) }
18
19
  else
@@ -20,7 +20,7 @@ module Capybara
20
20
 
21
21
  def save
22
22
  # if current_path empty then nothing to screen shot as browser has not loaded any URL
23
- return if capybara.current_path.to_s.empty?
23
+ return if page.current_path.to_s.empty?
24
24
 
25
25
  save_html if @html_save
26
26
  save_screenshot
@@ -28,7 +28,7 @@ module Capybara
28
28
 
29
29
  def save_html
30
30
  path = html_path
31
- clear_save_and_open_page_path do
31
+ clear_save_path do
32
32
  if Capybara::VERSION.match(/^\d+/)[0] == '1'
33
33
  capybara.save_page(page.body, "#{path}")
34
34
  else
@@ -40,7 +40,7 @@ module Capybara
40
40
 
41
41
  def save_screenshot
42
42
  path = screenshot_path
43
- clear_save_and_open_page_path do
43
+ clear_save_path do
44
44
  result = Capybara::Screenshot.registered_drivers.fetch(capybara.current_driver) { |driver_name|
45
45
  warn "capybara-screenshot could not detect a screenshot driver for '#{capybara.current_driver}'. Saving with default with unknown results."
46
46
  Capybara::Screenshot.registered_drivers[:default]
@@ -65,15 +65,15 @@ module Capybara
65
65
  @screenshot_saved
66
66
  end
67
67
 
68
- # If Capybara.save_and_open_page_path is set then
68
+ # If Capybara::Screenshot.capybara_tmp_path is set then
69
69
  # the html_path or screenshot_path can be appended to this path in
70
70
  # some versions of Capybara instead of using it as an absolute path
71
- def clear_save_and_open_page_path
72
- old_path = Capybara.save_and_open_page_path
73
- Capybara.save_and_open_page_path = nil
71
+ def clear_save_path
72
+ old_path = Capybara::Screenshot.capybara_tmp_path
73
+ Capybara::Screenshot.capybara_tmp_path = nil
74
74
  yield
75
75
  ensure
76
- Capybara.save_and_open_page_path = old_path
76
+ Capybara::Screenshot.capybara_tmp_path = old_path
77
77
  end
78
78
 
79
79
  def output_screenshot_path
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Screenshot
3
- VERSION = '1.0.13'
3
+ VERSION = '1.0.14'
4
4
  end
5
5
  end
@@ -6,7 +6,7 @@ describe Capybara::Screenshot::RSpec, :type => :aruba do
6
6
 
7
7
  before do
8
8
  setup_aruba
9
- Capybara.save_and_open_page_path = expand_path('tmp')
9
+ Capybara::Screenshot.capybara_tmp_path = expand_path('tmp')
10
10
  end
11
11
 
12
12
  def run_failing_case(code, error_message, format=nil)
@@ -20,7 +20,7 @@ module CommonSetup
20
20
  target.let(:setup_test_app) do
21
21
  <<-RUBY
22
22
  require 'support/test_app'
23
- Capybara.save_and_open_page_path = '#{screenshot_path}'
23
+ Capybara::Screenshot.capybara_tmp_path = '#{screenshot_path}'
24
24
  Capybara.app = TestApp
25
25
  Capybara::Screenshot.append_timestamp = false
26
26
  #{@additional_setup_steps}
@@ -33,6 +33,14 @@ module CommonSetup
33
33
  end
34
34
  end
35
35
 
36
+ target.after(:each) do |example|
37
+ if example.exception
38
+ puts "Output from failed Aruba test:"
39
+ puts all_output.split(/\n/).map { |line| " #{line}"}
40
+ puts ""
41
+ end
42
+ end
43
+
36
44
  def run_simple_with_retry(*args)
37
45
  run_simple(*args)
38
46
  rescue ChildProcess::TimeoutError => e
@@ -27,7 +27,7 @@ describe Capybara::Screenshot::Pruner do
27
27
  let(:strategy) { :invalid_strategy }
28
28
 
29
29
  it 'raises an error' do
30
- expect { pruner }.to raise_error
30
+ expect { pruner }.to raise_error(/Invalid prune strategy/)
31
31
  end
32
32
  end
33
33
 
@@ -35,7 +35,7 @@ describe Capybara::Screenshot::Pruner do
35
35
  let(:strategy) { { keep: :symbol } }
36
36
 
37
37
  it 'raises an error' do
38
- expect { pruner }.to raise_error
38
+ expect { pruner }.to raise_error(/must be a Integer/)
39
39
  end
40
40
  end
41
41
  end
@@ -21,11 +21,14 @@ describe Capybara::Screenshot::Saver do
21
21
  let(:screenshot_path) { "#{capybara_root}/#{file_basename}.png" }
22
22
 
23
23
  let(:driver_mock) { double('Capybara driver').as_null_object }
24
- let(:page_mock) { double('Capybara session page', :body => 'body', :driver => driver_mock).as_null_object }
24
+ let(:page_mock) {
25
+ double('Capybara session page', :body => 'body', :driver => driver_mock).as_null_object.tap do |m|
26
+ allow(m).to receive(:current_path).and_return('/')
27
+ end
28
+ }
25
29
  let(:capybara_mock) {
26
30
  double(Capybara).as_null_object.tap do |m|
27
31
  allow(m).to receive(:current_driver).and_return(:default)
28
- allow(m).to receive(:current_path).and_return('/')
29
32
  end
30
33
  }
31
34
 
@@ -110,7 +113,7 @@ describe Capybara::Screenshot::Saver do
110
113
  end
111
114
 
112
115
  it 'does not save if current_path is empty' do
113
- allow(capybara_mock).to receive(:current_path).and_return(nil)
116
+ allow(page_mock).to receive(:current_path).and_return(nil)
114
117
  expect(capybara_mock).to_not receive(:save_page)
115
118
  expect(driver_mock).to_not receive(:render)
116
119
 
@@ -121,7 +124,7 @@ describe Capybara::Screenshot::Saver do
121
124
 
122
125
  context 'when saving a screenshot fails' do
123
126
  it 'still restores the original value of Capybara.save_and_open_page_path' do
124
- Capybara.save_and_open_page_path = 'tmp/bananas'
127
+ Capybara::Screenshot.capybara_tmp_path = 'tmp/bananas'
125
128
 
126
129
  expect(capybara_mock).to receive(:save_page).and_raise
127
130
 
@@ -129,7 +132,11 @@ describe Capybara::Screenshot::Saver do
129
132
  saver.save
130
133
  }.to raise_error(RuntimeError)
131
134
 
132
- expect(Capybara.save_and_open_page_path).to eq('tmp/bananas')
135
+ if Capybara.respond_to?(:save_path)
136
+ expect(Capybara.save_path).to eq('tmp/bananas')
137
+ else
138
+ expect(Capybara.save_and_open_page_path).to eq('tmp/bananas')
139
+ end
133
140
  end
134
141
  end
135
142
 
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.13
4
+ version: 1.0.14
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: 2016-05-23 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -188,14 +188,11 @@ files:
188
188
  - README.md
189
189
  - Rakefile
190
190
  - capybara-screenshot.gemspec
191
- - gemfiles/cucumber.1.2.gemfile
192
- - gemfiles/cucumber.1.3.0.gemfile
191
+ - gemfiles/cucumber.1.3.gemfile
192
+ - gemfiles/cucumber.2.4.gemfile
193
193
  - gemfiles/latest.gemfile
194
- - gemfiles/rspec.2.14.gemfile
195
- - gemfiles/rspec.2.99.gemfile
196
194
  - gemfiles/rspec.3.0.gemfile
197
- - gemfiles/spinach.0.7.gemfile
198
- - gemfiles/spinach.0.8.0.gemfile
195
+ - gemfiles/spinach.0.8.gemfile
199
196
  - lib/capybara-screenshot.rb
200
197
  - lib/capybara-screenshot/capybara.rb
201
198
  - lib/capybara-screenshot/cucumber.rb
@@ -258,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
255
  version: '0'
259
256
  requirements: []
260
257
  rubyforge_project: capybara-screenshot
261
- rubygems_version: 2.4.6
258
+ rubygems_version: 2.4.8
262
259
  signing_key:
263
260
  specification_version: 4
264
261
  summary: Automatically create snapshots when Cucumber steps fail with Capybara and
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rake"
6
- gem "appraisal"
7
- gem "cucumber", "1.2"
8
-
9
- gemspec :path => "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rake"
6
- gem "appraisal"
7
- gem "cucumber", "1.3.0"
8
-
9
- gemspec :path => "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rake"
6
- gem "appraisal"
7
- gem "rspec", "2.14"
8
-
9
- gemspec :path => "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rake"
6
- gem "appraisal"
7
- gem "rspec", "2.99"
8
-
9
- gemspec :path => "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rake"
6
- gem "appraisal"
7
- gem "spinach", "0.7"
8
-
9
- gemspec :path => "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rake"
6
- gem "appraisal"
7
- gem "spinach", "0.8.0"
8
-
9
- gemspec :path => "../"