capybara-screenshot 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NDAzM2M0MmMxYjBmOGQ4YmUyYTYwZjhlM2U4YTk5OWYyYzk3NDFhOA==
5
- data.tar.gz: !binary |-
6
- NGUxYzEyYTc1MTcwMzBiOGJhMTA0ZjljMDZhNzEzZDA0OTMyNjMwNA==
2
+ SHA1:
3
+ metadata.gz: 0fb2ac718fb87183d57ce6b852dcd9a7f21d908d
4
+ data.tar.gz: 71177ec4576776a6ed0368cecfbb335e52e78457
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YmRiZTIyZGY2YTA1NTZiYzlmMDRkN2M0NmI3ZWE0NTAxNTQyZjI4NjQwZTEw
10
- YTA5N2UyZDJmN2ExZmU2ZTVkOGU5MTg0MjU2OGI3NjFkODY2NzU2MzhjZDJh
11
- ODZkNmQxYmViNjE1NTcyM2Q2NmEwN2ZlNzQyNWZjNjBiYzllMDc=
12
- data.tar.gz: !binary |-
13
- NGUyZDFiNWQyZjYyZGIwM2U2MDNlMTY1NWMxOTg0NWM3ZTIxMTFlMTNhMjJj
14
- Y2E3ZmMzMjY3M2RjNmMzNDQ4ZTZjODdkMjJiNDU2MGU0NWJlMDE4MTUwZjli
15
- NmNjNjU1MzFjMjEzMzg5ZGFhMzk2ZjFmNmI5YWQ5MmRiNjdlOWY=
6
+ metadata.gz: 78fcfead269c5570bfa3309d2263ca664359aa8ede1ce21e3a61af8bcb2ca9ca4f3b488b0bbc02cfc4da75ae6b35d0132977cf1e069ef120d3e6b651476b2a6c
7
+ data.tar.gz: 883369b31dc3b1e0ae3e1aa477892638f5adb745e9a53ff4ea0a49f8dc2b5a1782bbe59373afbe79063ed003e452dcd5eae61119ff5a7a94b97bf84614035b1c
data/.gitignore CHANGED
@@ -5,3 +5,5 @@ gemfiles/*.lock
5
5
  pkg/*
6
6
  .rvmrc
7
7
  bin
8
+ tmp
9
+ .ruby-version
@@ -1,4 +1,13 @@
1
- 22 July 2015 - 1.0.10 -> 1.0.111
1
+ 29 March 2016 - 1.0.11 -> 1.0.12
2
+
3
+ * [Aruba upgrade - passing CI](https://github.com/mattheworiordan/capybara-screenshot/pull/156)
4
+ * [imgcat support](https://github.com/mattheworiordan/capybara-screenshot/pull/153)
5
+ * [Fix for capaybara root when Rails not defined](https://github.com/mattheworiordan/capybara-screenshot/pull/139)
6
+ * [Fix using_session_with_screenshot](https://github.com/mattheworiordan/capybara-screenshot/pull/132)
7
+ * [Skip screenshot on skipped test](https://github.com/mattheworiordan/capybara-screenshot/pull/131)
8
+ * [Don't output screenshot paths if not saved](https://github.com/mattheworiordan/capybara-screenshot/pull/128)
9
+
10
+ 22 July 2015 - 1.0.10 -> 1.0.11
2
11
 
3
12
  * [Support for Fuubar reporter](https://github.com/mattheworiordan/capybara-screenshot/pull/137)
4
13
 
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
 
6
6
  gem 'rake'
7
7
  gem 'appraisal'
8
+ gem 'aruba', '~> 0.14.0'
data/README.md CHANGED
@@ -59,6 +59,15 @@ Typically in 'test/test_helper.rb', please add:
59
59
  require 'capybara-screenshot/minitest'
60
60
  ```
61
61
 
62
+ Also, consider adding `include Capybara::Screenshot::MiniTestPlugin` to any test classes that fail. For example, to capture screenshots for all failing integration tests in minitest-rails, try something like:
63
+
64
+ ```ruby
65
+ class ActionDispatch::IntegrationTest
66
+ include Capybara::Screenshot::MiniTestPlugin
67
+ # ...
68
+ end
69
+ ```
70
+
62
71
  #### Test::Unit
63
72
 
64
73
  Typically in 'test/test_helper.rb', please add:
@@ -157,7 +166,8 @@ Capybara::Screenshot.append_timestamp = false
157
166
 
158
167
  Custom screenshot directory
159
168
  --------------------------
160
- By default screenshots are saved into `$APPLICATION_ROOT/tmp/capybara`. If you want to customize the location, override the file path as:
169
+ By default, when running under Rails, Sinatra, and Padrino, screenshots are saved into `$APPLICATION_ROOT/tmp/capybara`. Otherwise, they're saved under `Dir.pwd`.
170
+ If you want to customize the location, override the file path as:
161
171
 
162
172
  ```ruby
163
173
  Capybara.save_and_open_page_path = "/file/path"
@@ -27,17 +27,19 @@ module Capybara
27
27
 
28
28
  def self.screenshot_and_save_page
29
29
  saver = Saver.new(Capybara, Capybara.page)
30
- saver.save
31
- {:html => saver.html_path, :image => saver.screenshot_path}
30
+ if saver.save
31
+ {:html => saver.html_path, :image => saver.screenshot_path}
32
+ end
32
33
  end
33
34
 
34
35
  def self.screenshot_and_open_image
35
36
  require "launchy"
36
37
 
37
38
  saver = Saver.new(Capybara, Capybara.page, false)
38
- saver.save
39
- Launchy.open saver.screenshot_path
40
- {:html => nil, :image => saver.screenshot_path}
39
+ if saver.save
40
+ Launchy.open saver.screenshot_path
41
+ {:html => nil, :image => saver.screenshot_path}
42
+ end
41
43
  end
42
44
 
43
45
  class << self
@@ -52,10 +54,10 @@ module Capybara
52
54
  end
53
55
 
54
56
  def self.capybara_root
55
- @capybara_root ||= if defined?(::Rails)
57
+ @capybara_root ||= if defined?(::Rails) && Rails.root.present?
56
58
  ::Rails.root.join capybara_tmp_path
57
59
  elsif defined?(Padrino)
58
- Padrino.root capybara_tmp_path
60
+ File.expand_path(capybara_tmp_path, Padrino.root)
59
61
  elsif defined?(Sinatra)
60
62
  File.join(Sinatra::Application.root, capybara_tmp_path)
61
63
  else
@@ -13,13 +13,11 @@ module Capybara
13
13
  Capybara::Screenshot.screenshot_and_open_image
14
14
  end
15
15
 
16
- def using_session_with_screenshot(name)
17
- using_session_without_screenshot(name) do
18
- original_session_name = Capybara.session_name
19
- Capybara::Screenshot.final_session_name = name
20
- yield
21
- Capybara::Screenshot.final_session_name = original_session_name
22
- end
16
+ def using_session_with_screenshot(name,&blk)
17
+ original_session_name = Capybara.session_name
18
+ Capybara::Screenshot.final_session_name = name
19
+ using_session_without_screenshot(name,&blk)
20
+ Capybara::Screenshot.final_session_name = original_session_name
23
21
  end
24
22
 
25
23
  alias_method :using_session_without_screenshot, :using_session
@@ -1,4 +1,5 @@
1
1
  require "capybara-screenshot"
2
+ require 'mkmf'
2
3
 
3
4
  Before do |scenario|
4
5
  Capybara::Screenshot.final_session_name = nil
@@ -18,8 +19,9 @@ After do |scenario|
18
19
  require "base64"
19
20
  #encode the image into it's base64 representation
20
21
  image = open(saver.screenshot_path, 'rb') {|io|io.read}
21
- encoded_img = Base64.encode64(image)
22
+ saver.display_image
22
23
  #this will embed the image in the HTML report, embed() is defined in cucumber
24
+ encoded_img = Base64.encode64(image)
23
25
  embed(encoded_img, 'image/png;base64', "Screenshot of the error")
24
26
  end
25
27
  end
@@ -9,7 +9,7 @@ module Capybara::Screenshot::MiniTestPlugin
9
9
  def after_teardown
10
10
  super
11
11
  if self.class.ancestors.map(&:to_s).include?('ActionDispatch::IntegrationTest')
12
- if Capybara::Screenshot.autosave_on_failure && !passed?
12
+ if Capybara::Screenshot.autosave_on_failure && !passed? && !skipped?
13
13
  Capybara.using_session(Capybara::Screenshot.final_session_name) do
14
14
  filename_prefix = Capybara::Screenshot.filename_prefix_for(:minitest, self)
15
15
 
@@ -22,6 +22,15 @@ module Capybara::Screenshot::MiniTestPlugin
22
22
  end
23
23
  end
24
24
 
25
- class MiniTest::Unit::TestCase
26
- include Capybara::Screenshot::MiniTestPlugin
25
+ begin
26
+ Minitest.const_get('Test')
27
+ class Minitest::Test
28
+ include Capybara::Screenshot::MiniTestPlugin
29
+ end
30
+ rescue NameError => e
31
+ class MiniTest::Unit::TestCase
32
+ include Capybara::Screenshot::MiniTestPlugin
33
+ end
27
34
  end
35
+
36
+
@@ -81,10 +81,34 @@ module Capybara
81
81
  output "Image screenshot: #{screenshot_path}" if screenshot_saved?
82
82
  end
83
83
 
84
+ # Print image to screen, if imgcat is available
85
+ def display_image
86
+ system("#{imgcat} #{screenshot_path}") unless imgcat.nil?
87
+ end
88
+
84
89
  private
90
+
85
91
  def output(message)
86
92
  puts " #{CapybaraScreenshot::Helpers.yellow(message)}"
87
93
  end
94
+
95
+ def imgcat
96
+ @imgcat ||= which('imgcat')
97
+ end
98
+
99
+ # Cross-platform way of finding an executable in the $PATH.
100
+ #
101
+ # which('ruby') #=> /usr/bin/ruby
102
+ def which(cmd)
103
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
104
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
105
+ exts.each { |ext|
106
+ exe = File.join(path, "#{cmd}#{ext}")
107
+ return exe if File.executable?(exe) && !File.directory?(exe)
108
+ }
109
+ end
110
+ return nil
111
+ end
88
112
  end
89
113
  end
90
114
  end
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Screenshot
3
- VERSION = '1.0.11'
3
+ VERSION = '1.0.12'
4
4
  end
5
5
  end
@@ -4,14 +4,14 @@ describe "Using Capybara::Screenshot with Cucumber" do
4
4
  include CommonSetup
5
5
 
6
6
  before do
7
- clean_current_dir
7
+ setup_aruba
8
8
  end
9
9
 
10
- let(:cmd) { 'bundle exec cucumber' }
10
+ let(:cmd) { 'cucumber' }
11
11
 
12
12
  def run_failing_case(failure_message, code)
13
13
  run_case code
14
- expect(output_from(cmd)).to match(failure_message)
14
+ expect(last_command_started.output).to match(failure_message)
15
15
  end
16
16
 
17
17
  def run_case(code, options = {})
@@ -32,7 +32,7 @@ describe "Using Capybara::Screenshot with Cucumber" do
32
32
 
33
33
  run_simple_with_retry cmd, false
34
34
 
35
- expect(output_from(cmd)).to_not include('failed)') if options[:assert_all_passed]
35
+ expect(last_command_started.output).to_not match(/failed|failure/i) if options[:assert_all_passed]
36
36
  end
37
37
 
38
38
  it 'saves a screenshot on failure' do
@@ -42,7 +42,7 @@ describe "Using Capybara::Screenshot with Cucumber" do
42
42
  Given I visit "/"
43
43
  And I click on a missing link
44
44
  CUCUMBER
45
- check_file_content 'tmp/my_screenshot.html', 'This is the root page', true
45
+ expect('tmp/my_screenshot.html').to have_file_content('This is the root page')
46
46
  end
47
47
 
48
48
  it 'saves a screenshot on an error' do
@@ -52,7 +52,7 @@ describe "Using Capybara::Screenshot with Cucumber" do
52
52
  Given I visit "/"
53
53
  And I trigger an unhandled exception
54
54
  CUCUMBER
55
- check_file_content 'tmp/my_screenshot.html', 'This is the root page', true
55
+ expect('tmp/my_screenshot.html').to have_file_content('This is the root page')
56
56
  end
57
57
 
58
58
  it 'saves a screenshot for the correct session for failures using_session' do
@@ -62,7 +62,7 @@ describe "Using Capybara::Screenshot with Cucumber" do
62
62
  Given I visit "/"
63
63
  And I click on a missing link on a different page in a different session
64
64
  CUCUMBER
65
- check_file_content 'tmp/my_screenshot.html', 'This is a different page', true
65
+ expect('tmp/my_screenshot.html').to have_file_content('This is a different page')
66
66
  end
67
67
 
68
68
  context 'pruning' do
@@ -2,7 +2,7 @@ require 'capybara/cucumber'
2
2
  require 'capybara-screenshot'
3
3
  require 'capybara-screenshot/cucumber'
4
4
  require 'aruba/cucumber'
5
- require 'aruba/jruby'
5
+ require 'aruba/config/jruby'
6
6
 
7
7
  Capybara::Screenshot.register_filename_prefix_formatter(:cucumber) do |fault|
8
8
  'my_screenshot'
@@ -4,7 +4,7 @@ describe "Using Capybara::Screenshot with MiniTest" do
4
4
  include CommonSetup
5
5
 
6
6
  before do
7
- clean_current_dir
7
+ setup_aruba
8
8
  end
9
9
 
10
10
  def run_failing_case(code)
@@ -27,7 +27,7 @@ describe "Using Capybara::Screenshot with MiniTest" do
27
27
 
28
28
  cmd = 'bundle exec ruby test_failure.rb'
29
29
  run_simple_with_retry cmd, false
30
- expect(output_from(cmd)).to include %q{Unable to find link or button "you'll never find me"}
30
+ expect(last_command_started.output).to include %q{Unable to find link or button "you'll never find me"}
31
31
  end
32
32
 
33
33
  it 'saves a screenshot on failure' do
@@ -46,7 +46,7 @@ describe "Using Capybara::Screenshot with MiniTest" do
46
46
  end
47
47
  end
48
48
  RUBY
49
- check_file_content 'tmp/my_screenshot.html', 'This is the root page', true
49
+ expect('tmp/my_screenshot.html').to have_file_content('This is the root page')
50
50
  end
51
51
 
52
52
  it "does not save a screenshot for tests that don't inherit from ActionDispatch::IntegrationTest" do
@@ -61,7 +61,7 @@ describe "Using Capybara::Screenshot with MiniTest" do
61
61
  end
62
62
  end
63
63
  RUBY
64
- check_file_presence(%w{tmp/my_screenshot.html}, false)
64
+ expect('tmp/my_screenshot.html').to_not be_an_existing_file
65
65
  end
66
66
 
67
67
  it 'saves a screenshot for the correct session for failures using_session' do
@@ -84,7 +84,7 @@ describe "Using Capybara::Screenshot with MiniTest" do
84
84
  end
85
85
  end
86
86
  RUBY
87
- check_file_content 'tmp/my_screenshot.html', 'This is a different page', true
87
+ expect('tmp/my_screenshot.html').to have_file_content('This is a different page')
88
88
  end
89
89
 
90
90
  it 'prunes screenshots on failure' do
@@ -4,7 +4,7 @@ describe "Using Capybara::Screenshot with Test::Unit" do
4
4
  include CommonSetup
5
5
 
6
6
  before do
7
- clean_current_dir
7
+ setup_aruba
8
8
  end
9
9
 
10
10
  def run_failing_case(code, integration_path = '.')
@@ -33,7 +33,7 @@ describe "Using Capybara::Screenshot with Test::Unit" do
33
33
 
34
34
  cmd = "bundle exec ruby #{integration_path}/test_failure.rb"
35
35
  run_simple_with_retry cmd, false
36
- expect(output_from(cmd)).to include %q{Unable to find link or button "you'll never find me"}
36
+ expect(last_command_started.output).to include %q{Unable to find link or button "you'll never find me"}
37
37
  end
38
38
 
39
39
  it "saves a screenshot on failure for any test in path 'test/integration'" do
@@ -42,7 +42,7 @@ describe "Using Capybara::Screenshot with Test::Unit" do
42
42
  assert(page.body.include?('This is the root page'))
43
43
  click_on "you'll never find me"
44
44
  RUBY
45
- check_file_content 'tmp/my_screenshot.html', 'This is the root page', true
45
+ expect('tmp/my_screenshot.html').to have_file_content('This is the root page')
46
46
  end
47
47
 
48
48
  it "does not generate a screenshot for tests that are not in 'test/integration'" do
@@ -52,7 +52,7 @@ describe "Using Capybara::Screenshot with Test::Unit" do
52
52
  click_on "you'll never find me"
53
53
  RUBY
54
54
 
55
- check_file_presence(%w{tmp/my_screenshot.html}, false)
55
+ expect('tmp/my_screenshot.html').to_not be_an_existing_file
56
56
  end
57
57
 
58
58
  it 'saves a screenshot for the correct session for failures using_session' do
@@ -65,7 +65,7 @@ describe "Using Capybara::Screenshot with Test::Unit" do
65
65
  click_on "you'll never find me"
66
66
  end
67
67
  RUBY
68
- check_file_content 'tmp/my_screenshot.html', 'This is a different page', true
68
+ expect('tmp/my_screenshot.html').to have_file_content('This is a different page')
69
69
  end
70
70
 
71
71
  it 'prunes screenshots on failure' do
@@ -1,21 +1,20 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Capybara::Screenshot::RSpec do
3
+ describe Capybara::Screenshot::RSpec, :type => :aruba do
4
4
  describe "used with RSpec" do
5
5
  include CommonSetup
6
6
 
7
7
  before do
8
- clean_current_dir
8
+ setup_aruba
9
+ Capybara.save_and_open_page_path = expand_path('tmp')
9
10
  end
10
11
 
11
12
  def run_failing_case(code, error_message, format=nil)
12
13
  run_case code, format: format
13
-
14
- cmd = cmd_with_format(format)
15
14
  if error_message.kind_of?(Regexp)
16
- expect(output_from(cmd)).to match(error_message)
15
+ expect(last_command_started.output).to match(error_message)
17
16
  else
18
- expect(output_from(cmd)).to include(error_message)
17
+ expect(last_command_started.output).to include(error_message)
19
18
  end
20
19
  end
21
20
 
@@ -35,11 +34,11 @@ describe Capybara::Screenshot::RSpec do
35
34
  cmd = cmd_with_format(options[:format])
36
35
  run_simple_with_retry cmd, false
37
36
 
38
- expect(output_from(cmd)).to include('0 failures') if options[:assert_all_passed]
37
+ expect(last_command_started.output).to match('0 failures') if options[:assert_all_passed]
39
38
  end
40
39
 
41
40
  def cmd_with_format(format)
42
- "bundle exec rspec #{"--format #{format} " if format}spec/test_failure.rb"
41
+ "rspec #{"--format #{format} " if format}#{expand_path('spec/test_failure.rb')}"
43
42
  end
44
43
 
45
44
  it 'saves a screenshot on failure' do
@@ -52,7 +51,7 @@ describe Capybara::Screenshot::RSpec do
52
51
  end
53
52
  end
54
53
  RUBY
55
- check_file_content('tmp/screenshot.html', 'This is the root page', true)
54
+ expect(expand_path('tmp/screenshot.html')).to_not have_file_content('This is the root page')
56
55
  end
57
56
 
58
57
  formatters = {
@@ -76,7 +75,7 @@ describe Capybara::Screenshot::RSpec do
76
75
  end
77
76
  end
78
77
  RUBY
79
- check_file_content('tmp/screenshot.html', 'This is the root page', true)
78
+ expect('tmp/screenshot.html').to have_file_content('This is the root page')
80
79
  end
81
80
  end
82
81
 
@@ -88,7 +87,7 @@ describe Capybara::Screenshot::RSpec do
88
87
  end
89
88
  end
90
89
  RUBY
91
- check_file_presence(%w{tmp/screenshot.html}, false)
90
+ expect('tmp/screenshot.html').to_not be_an_existing_file
92
91
  end
93
92
 
94
93
  it 'saves a screenshot for the correct session for failures using_session' do
@@ -105,7 +104,7 @@ describe Capybara::Screenshot::RSpec do
105
104
  end
106
105
  end
107
106
  RUBY
108
- check_file_content('tmp/screenshot.html', 'This is a different page', true)
107
+ expect('tmp/screenshot.html').to have_file_content(/is/)
109
108
  end
110
109
 
111
110
  context 'pruning' do
@@ -10,10 +10,6 @@ require 'rspec'
10
10
  require 'capybara-screenshot'
11
11
  require 'capybara-screenshot/rspec'
12
12
  require 'timecop'
13
- require 'aruba/api'
14
- require 'aruba/jruby'
15
-
16
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
17
13
 
18
14
  RSpec.configure do |config|
19
15
  if RSpec::Core::Version::STRING.to_i == 2
@@ -27,3 +23,12 @@ RSpec.configure do |config|
27
23
  end
28
24
 
29
25
  Capybara.app = lambda { |env| [200, {}, ["OK"]] }
26
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
27
+
28
+ if RUBY_VERSION < '1.9.3'
29
+ ::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
30
+ ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
31
+ else
32
+ ::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
33
+ ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
34
+ end
@@ -4,7 +4,7 @@ describe "Using Capybara::Screenshot with Spinach" do
4
4
  include CommonSetup
5
5
 
6
6
  before do
7
- clean_current_dir
7
+ setup_aruba
8
8
  end
9
9
 
10
10
  def run_failing_case(failure_message, code)
@@ -17,7 +17,7 @@ describe "Using Capybara::Screenshot with Spinach" do
17
17
  write_file('spinach.feature', code)
18
18
  cmd = 'bundle exec spinach -f .'
19
19
  run_simple_with_retry cmd, false
20
- expect(output_from(cmd)).to match failure_message
20
+ expect(last_command_started.output).to match(failure_message)
21
21
  end
22
22
 
23
23
  it "saves a screenshot on failure" do
@@ -27,7 +27,7 @@ describe "Using Capybara::Screenshot with Spinach" do
27
27
  Given I visit "/"
28
28
  And I click on a missing link
29
29
  GHERKIN
30
- check_file_content('tmp/my_screenshot.html', 'This is the root page', true)
30
+ expect('tmp/my_screenshot.html').to have_file_content('This is the root page')
31
31
  end
32
32
 
33
33
  it "saves a screenshot on an error" do
@@ -37,7 +37,7 @@ describe "Using Capybara::Screenshot with Spinach" do
37
37
  Given I visit "/"
38
38
  And I trigger an unhandled exception
39
39
  GHERKIN
40
- check_file_content('tmp/my_screenshot.html', 'This is the root page', true)
40
+ expect('tmp/my_screenshot.html').to have_file_content('This is the root page')
41
41
  end
42
42
 
43
43
  it "saves a screenshot for the correct session for failures using_session" do
@@ -47,7 +47,7 @@ describe "Using Capybara::Screenshot with Spinach" do
47
47
  Given I visit "/"
48
48
  And I click on a missing link on a different page in a different session
49
49
  GHERKIN
50
- check_file_content('tmp/my_screenshot.html', 'This is a different page', true)
50
+ expect('tmp/my_screenshot.html').to have_file_content('This is a different page')
51
51
  end
52
52
 
53
53
  it 'on failure it prunes previous screenshots when strategy is set' do
@@ -0,0 +1,3 @@
1
+ require 'aruba/rspec'
2
+ require 'aruba/api'
3
+ require 'aruba/config/jruby'
@@ -49,11 +49,11 @@ module CommonSetup
49
49
  end
50
50
 
51
51
  def assert_screenshot_pruned
52
- check_file_presence Array(screenshot_for_pruning_path), false
52
+ expect(screenshot_for_pruning_path).to_not be_an_existing_file
53
53
  end
54
54
 
55
55
  def assert_screenshot_not_pruned
56
- check_file_presence Array(screenshot_for_pruning_path), true
56
+ expect(screenshot_for_pruning_path).to be_an_existing_file
57
57
  end
58
58
  end
59
59
  end
@@ -33,6 +33,13 @@ describe Capybara::Screenshot do
33
33
 
34
34
  expect(Capybara::Screenshot.filename_prefix_formatters[:foo]).to eql(block)
35
35
  end
36
+
37
+ describe '.filename_prefix_for' do
38
+ it 'returns "configured formatter" for specified formatter' do
39
+ Capybara::Screenshot.register_filename_prefix_formatter(:foo) { |arg| 'custom_path' }
40
+ expect(Capybara::Screenshot.filename_prefix_for(:foo, double('test'))).to eql('custom_path')
41
+ end
42
+ end
36
43
  end
37
44
 
38
45
  describe '.filename_prefix_for' do
@@ -127,7 +127,7 @@ describe Capybara::Screenshot::Saver do
127
127
 
128
128
  expect {
129
129
  saver.save
130
- }.to raise_error
130
+ }.to raise_error(RuntimeError)
131
131
 
132
132
  expect(Capybara.save_and_open_page_path).to eq('tmp/bananas')
133
133
  end
metadata CHANGED
@@ -1,159 +1,159 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-screenshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
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: 2015-07-22 00:00:00.000000000 Z
11
+ date: 2016-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
- - - <
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '3'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ! '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.0'
30
- - - <
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '3'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: launchy
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ! '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ! '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ! '>='
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ! '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: timecop
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ! '>='
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ! '>='
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: cucumber
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ! '>='
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ! '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: aruba
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ! '>='
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ! '>='
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: sinatra
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ! '>='
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ! '>='
114
+ - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: test-unit
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - ! '>='
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - ! '>='
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: spinach
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - ! '>='
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - ! '>='
142
+ - - ">="
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: minitest
147
147
  requirement: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ! '>='
149
+ - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
- - - ! '>='
156
+ - - ">="
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  description: When a Cucumber step fails, it is useful to create a screenshot image
@@ -164,9 +164,9 @@ executables: []
164
164
  extensions: []
165
165
  extra_rdoc_files: []
166
166
  files:
167
- - .gitignore
168
- - .rspec
169
- - .travis.yml
167
+ - ".gitignore"
168
+ - ".rspec"
169
+ - ".travis.yml"
170
170
  - Appraisals
171
171
  - CHANGELOG.md
172
172
  - Gemfile
@@ -207,6 +207,7 @@ files:
207
207
  - spec/spec_helper.rb
208
208
  - spec/spinach/spinach_spec.rb
209
209
  - spec/spinach/support/spinach_failure.rb
210
+ - spec/support/aruba.rb
210
211
  - spec/support/common_setup.rb
211
212
  - spec/support/html_reporter_context.rb
212
213
  - spec/support/test_app.rb
@@ -230,12 +231,12 @@ require_paths:
230
231
  - lib
231
232
  required_ruby_version: !ruby/object:Gem::Requirement
232
233
  requirements:
233
- - - ! '>='
234
+ - - ">="
234
235
  - !ruby/object:Gem::Version
235
236
  version: '0'
236
237
  required_rubygems_version: !ruby/object:Gem::Requirement
237
238
  requirements:
238
- - - ! '>='
239
+ - - ">="
239
240
  - !ruby/object:Gem::Version
240
241
  version: '0'
241
242
  requirements: []
@@ -255,6 +256,7 @@ test_files:
255
256
  - spec/spec_helper.rb
256
257
  - spec/spinach/spinach_spec.rb
257
258
  - spec/spinach/support/spinach_failure.rb
259
+ - spec/support/aruba.rb
258
260
  - spec/support/common_setup.rb
259
261
  - spec/support/html_reporter_context.rb
260
262
  - spec/support/test_app.rb