Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

change to work with the latest capybara-webkit

  • Loading branch information...
commit 7c2c21ac0cfa4cea1df9c67a252e82bdab87f044 1 parent 632fbe0
@eitoball eitoball authored
View
6 lib/capybara-screenshot.rb
@@ -82,7 +82,11 @@ def self.register_filename_prefix_formatter(test_type, &block)
end
register_driver(:webkit) do |driver, path|
- driver.render(path)
+ if driver.respond_to?(:save_screenshot)
+ driver.save_screenshot(path)
+ else
+ driver.render(path)
+ end
end
register_driver(:webkit_debug) do |driver, path|
View
26 spec/capybara-screenshot/saver_spec.rb
@@ -138,10 +138,28 @@
capybara_mock.stub(:current_driver).and_return(:webkit)
end
- it 'should save driver render' do
- driver_mock.should_receive(:render).with(screenshot_path)
+ context 'has render method' do
+ before do
+ driver_mock.stub(:respond_to?).with(:'save_screenshot').and_return(false)
+ end
- saver.save
+ it 'should save driver render' do
+ driver_mock.should_receive(:render).with(screenshot_path)
+
+ saver.save
+ end
+ end
+
+ context 'has save_screenshot method' do
+ before do
+ driver_mock.stub(:respond_to?).with(:'save_screenshot').and_return(true)
+ end
+
+ it 'should save driver render' do
+ driver_mock.should_receive(:save_screenshot).with(screenshot_path)
+
+ saver.save
+ end
end
end
@@ -176,4 +194,4 @@
saver.save
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.