Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

create specs to define current_url/pushState behavior

  • Loading branch information...
commit 5eacd085dac60fe545542ed0282044141e6680ff 1 parent 9eb8e55
Marc Schwieterman marcisme authored halogenandtoast committed
Showing with 26 additions and 0 deletions.
  1. +26 −0 spec/driver_spec.rb
26 spec/driver_spec.rb
View
@@ -132,6 +132,20 @@
subject.find("//input").first.click
subject.find("//p").first.text.should == ""
end
+
+ it "returns the current URL when changed by pushState after a redirect" do
+ subject.visit("/redirect-me")
+ port = subject.instance_variable_get("@rack_server").port
+ subject.execute_script("window.history.pushState({}, '', '/pushed-after-redirect')")
+ subject.current_url.should == "http://127.0.0.1:#{port}/pushed-after-redirect"
+ end
+
+ it "returns the current URL when changed by replaceState after a redirect" do
+ subject.visit("/redirect-me")
+ port = subject.instance_variable_get("@rack_server").port
+ subject.execute_script("window.history.replaceState({}, '', '/replaced-after-redirect')")
+ subject.current_url.should == "http://127.0.0.1:#{port}/replaced-after-redirect"
+ end
end
context "css app" do
@@ -223,6 +237,18 @@
subject.current_url.should == "http://127.0.0.1:#{port}/hello/world?success=true"
end
+ it "returns the current URL when changed by pushState" do
+ port = subject.instance_variable_get("@rack_server").port
+ subject.execute_script("window.history.pushState({}, '', '/pushed')")
+ subject.current_url.should == "http://127.0.0.1:#{port}/pushed"
+ end
+
+ it "returns the current URL when changed by replaceState" do
+ port = subject.instance_variable_get("@rack_server").port
+ subject.execute_script("window.history.replaceState({}, '', '/replaced')")
+ subject.current_url.should == "http://127.0.0.1:#{port}/replaced"
+ end
+
it "does not double-encode URLs" do
subject.visit("/hello/world?success=%25true")
subject.current_url.should =~ /success=\%25true/
Please sign in to comment.
Something went wrong with that request. Please try again.