capybara-screenshot 0.3.6 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,8 @@
1
- 18 Apri 2013
1
+ 18 Apr 2013
2
2
  -----------
3
3
 
4
4
  Improved documentation, Ruby 1.8.7 support by not allowing Capybara 2.1 to be used, improved Sinatra support.
5
+ RSpec screenshot fix to only screenshot when applicable: https://github.com/mattheworiordan/capybara-screenshot/issues/44
5
6
 
6
7
  07 Jan 2013
7
8
  -----------
@@ -2,7 +2,7 @@ RSpec.configure do |config|
2
2
  # use the before hook to add an after hook that runs last
3
3
  config.after do
4
4
  if Capybara.page.respond_to?(:save_page) # Capybara DSL method has been included for a feature we can snapshot
5
- if Capybara::Screenshot.autosave_on_failure && example.exception
5
+ if Capybara.page.current_url != '' && Capybara::Screenshot.autosave_on_failure && example.exception
6
6
  filename_prefix = Capybara::Screenshot.filename_prefix_for(:rspec, example)
7
7
 
8
8
  saver = Capybara::Screenshot::Saver.new(Capybara, Capybara.page, true, filename_prefix)
@@ -19,11 +19,11 @@ module Capybara
19
19
 
20
20
  def save_html
21
21
  if Capybara::VERSION.match(/^\d+/)[0] == '1'
22
- capybara.save_page(page.body, "#{file_base_name}.html")
22
+ capybara.save_page(page.body, "#{html_path}")
23
23
  else
24
- capybara.save_page("#{file_base_name}.html")
24
+ capybara.save_page("#{html_path}")
25
25
  end
26
- warn "Saved file #{file_base_name}"
26
+ warn "Saved file #{html_path}"
27
27
  end
28
28
 
29
29
  def save_screenshot
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Screenshot
3
- VERSION = "0.3.6"
3
+ VERSION = "0.3.8"
4
4
  end
5
5
  end
@@ -37,7 +37,7 @@ describe Capybara::Screenshot::Saver do
37
37
  end
38
38
 
39
39
  it 'should have default format of "screenshot_Y-M-D-H-M-S.ms.html"' do
40
- capybara_mock.should_receive(:save_page).with('body', "#{file_basename}.html")
40
+ capybara_mock.should_receive(:save_page).with('body', File.join(capybara_root, "#{file_basename}.html"))
41
41
 
42
42
  saver.save
43
43
  end
@@ -45,7 +45,7 @@ describe Capybara::Screenshot::Saver do
45
45
  it 'should use name argument as prefix' do
46
46
  saver = Capybara::Screenshot::Saver.new(capybara_mock, page_mock, true, 'custom-prefix')
47
47
 
48
- capybara_mock.should_receive(:save_page).with('body', "custom-prefix_#{timestamp}.html")
48
+ capybara_mock.should_receive(:save_page).with('body', File.join(capybara_root, "custom-prefix_#{timestamp}.html"))
49
49
 
50
50
  saver.save
51
51
  end
@@ -57,7 +57,7 @@ describe Capybara::Screenshot::Saver do
57
57
  end
58
58
 
59
59
  it 'should have default format of "screenshot_Y-M-D-H-M-S.ms.html"' do
60
- capybara_mock.should_receive(:save_page).with("#{file_basename}.html")
60
+ capybara_mock.should_receive(:save_page).with(File.join(capybara_root, "#{file_basename}.html"))
61
61
 
62
62
  saver.save
63
63
  end
@@ -65,7 +65,7 @@ describe Capybara::Screenshot::Saver do
65
65
  it 'should use name argument as prefix' do
66
66
  saver = Capybara::Screenshot::Saver.new(capybara_mock, page_mock, true, 'custom-prefix')
67
67
 
68
- capybara_mock.should_receive(:save_page).with("custom-prefix_#{timestamp}.html")
68
+ capybara_mock.should_receive(:save_page).with(File.join(capybara_root, "custom-prefix_#{timestamp}.html"))
69
69
 
70
70
  saver.save
71
71
  end
@@ -15,3 +15,5 @@ RSpec.configure do |config|
15
15
  config.run_all_when_everything_filtered = true
16
16
  config.filter_run :focus
17
17
  end
18
+
19
+ Capybara.app = lambda { |env| [200, {}, ["OK"]] }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-screenshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-18 00:00:00.000000000 Z
12
+ date: 2013-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capybara
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  segments:
109
109
  - 0
110
- hash: 3211411598851201235
110
+ hash: 3507128222500016468
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  none: false
113
113
  requirements:
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  segments:
118
118
  - 0
119
- hash: 3211411598851201235
119
+ hash: 3507128222500016468
120
120
  requirements: []
121
121
  rubyforge_project: capybara-screenshot
122
122
  rubygems_version: 1.8.24