diff --git a/README.md b/README.md index 57084f0..ffed9ea 100644 --- a/README.md +++ b/README.md @@ -309,6 +309,8 @@ Include as much information as possible. For example: [Issue #203] (@arnvald) * Fix the `:js_errors` option. Previously errors were not being reported, but would still cause commands to fail. [Issue #229] +* Fix incorrect time zone handling when setting cookie expiry time + [Issue #228] ### 1.0.2 ### diff --git a/lib/capybara/poltergeist/browser.rb b/lib/capybara/poltergeist/browser.rb index 986b7a6..2f88ea1 100644 --- a/lib/capybara/poltergeist/browser.rb +++ b/lib/capybara/poltergeist/browser.rb @@ -153,8 +153,8 @@ module Capybara::Poltergeist end def set_cookie(cookie) - if cookie[:expires].respond_to?(:httpdate) - cookie[:expires] = cookie[:expires].httpdate + if cookie[:expires] + cookie[:expires] = cookie[:expires].to_i * 1000 end command 'set_cookie', cookie diff --git a/lib/capybara/poltergeist/cookie.rb b/lib/capybara/poltergeist/cookie.rb index 22d3b27..cbedc79 100644 --- a/lib/capybara/poltergeist/cookie.rb +++ b/lib/capybara/poltergeist/cookie.rb @@ -29,7 +29,7 @@ module Capybara::Poltergeist end def expires - Time.parse @attributes['expires'] if @attributes['expires'] + Time.at @attributes['expiry'] if @attributes['expiry'] end end end