capybara-screenshot 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,10 @@
1
+ 3 December 2011
2
+ ---------------
3
+
4
+ More robust handling of Minitest for users who have it installed as a dependency
5
+ https://github.com/mattheworiordan/capybara-screenshot/issues/5
6
+
7
+
1
8
  2 December 2011
2
9
  ---------------
3
10
 
@@ -1,27 +1,25 @@
1
1
  require 'capybara-screenshot/saver'
2
2
 
3
3
  if defined?(ActionDispatch::IntegrationTest)
4
- # older versions of Minitest support add_tear_downhook
5
- if defined?(ActionDispath::IntegrationTest.add_teardown_hook)
6
- ActionDispatch::IntegrationTest.add_teardown_hook do |context|
7
- # by adding the argument context, MiniTest passes the context of the test
8
- # which has an instance variable @passed indicating success / failure
9
- context.instance_eval do
10
- if @passed.blank?
11
- Capybara::Screenshot::Saver.screen_shot_and_save_page Capybara, Capybara.body
12
- end
13
- end
14
- end
15
- else
16
- # new since 2.8.1 use after instead of add_tear_downhook
17
- ActionDispatch::IntegrationTest.after do |context|
18
- # by adding the argument context, MiniTest passes the context of the test
19
- # which has an instance variable @passed indicating success / failure
20
- context.instance_eval do
21
- if @passed.blank?
22
- Capybara::Screenshot::Saver.screen_shot_and_save_page Capybara, Capybara.body
4
+ method = if ActionDispatch::IntegrationTest.respond_to? :teardown
5
+ :teardown
6
+ elsif ActionDispatch::IntegrationTest.respond_to? :add_tear_down_hook
7
+ :add_tear_down_hook
8
+ end
9
+
10
+ unless method.nil?
11
+ begin
12
+ ActionDispatch::IntegrationTest.send method do |context|
13
+ # by adding the argument context, MiniTest passes the context of the test
14
+ # which has an instance variable @passed indicating success / failure
15
+ context.instance_eval do
16
+ if @passed.blank?
17
+ Capybara::Screenshot::Saver.screen_shot_and_save_page Capybara, Capybara.body
18
+ end
23
19
  end
24
20
  end
21
+ rescue NoMethodError
22
+ # do nothing, teardown for minitest not available
25
23
  end
26
24
  end
27
25
  end
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Screenshot
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-screenshot
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthew O'Riordan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-02 00:00:00 +00:00
18
+ date: 2011-12-03 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency