From 36cc2bb792a68697b79670dc64dc2eda0da73332 Mon Sep 17 00:00:00 2001 From: Jason Woodward Date: Thu, 14 Jun 2012 14:27:51 -0400 Subject: [PATCH] stringify non-string paths to avoid Rails' .to_json implementation on Pathname objects --- lib/capybara/poltergeist/browser.rb | 2 +- spec/integration/driver_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/capybara/poltergeist/browser.rb b/lib/capybara/poltergeist/browser.rb index 4d7b937..cf2ab80 100644 --- a/lib/capybara/poltergeist/browser.rb +++ b/lib/capybara/poltergeist/browser.rb @@ -104,7 +104,7 @@ module Capybara::Poltergeist end def render(path, options = {}) - command 'render', path, !!options[:full] + command 'render', path.to_s, !!options[:full] end def resize(width, height) diff --git a/spec/integration/driver_spec.rb b/spec/integration/driver_spec.rb index 9a46906..f89e98e 100644 --- a/spec/integration/driver_spec.rb +++ b/spec/integration/driver_spec.rb @@ -95,6 +95,14 @@ module Capybara::Poltergeist end end + it 'supports rendering the page with a nonstring path' do + file = POLTERGEIST_ROOT + '/spec/tmp/screenshot.png' + FileUtils.rm_f file + @driver.visit('/') + @driver.render(Pathname(file)) + File.exist?(file).should == true + end + it 'supports executing multiple lines of javascript' do @driver.execute_script <<-JS var a = 1