0
@@ -10,7 +10,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page", {})
0
click_link "Save & go back"
0
it "should use get by default" do
0
@@ -30,7 +30,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page", {})
0
click_link "Link text", :method => :get
0
it "should click link on substring" do
0
@@ -40,7 +40,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page", {})
0
click_link "ink tex", :method => :get
0
it "should click delete links" do
0
@@ -50,8 +50,8 @@ describe "click_link" do
0
webrat_session.should_receive(:delete).with("/page", {})
0
click_link "Link text", :method => :delete
0
it "should click post links" do
0
@@ -61,7 +61,7 @@ describe "click_link" do
0
webrat_session.should_receive(:post).with("/page", {})
0
click_link "Link text", :method => :post
0
it "should click put links" do
0
@@ -71,7 +71,7 @@ describe "click_link" do
0
webrat_session.should_receive(:put).with("/page", {})
0
click_link "Link text", :method => :put
0
it "should click links by regexp" do
0
@@ -81,8 +81,8 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page", {})
0
click_link /link [a-z]/i
0
- it "should click links by id" do
0
+ it "should click links by id" do
0
<a id="link_text_link" href="/page">Link text</a>
0
@@ -91,8 +91,8 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page", {})
0
click_link "link_text_link"
0
- it "should click links by id regexp" do
0
+ it "should click links by id regexp" do
0
<a id="link_text_link" href="/page">Link text</a>
0
@@ -101,7 +101,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page", {})
0
it "should click rails javascript links with authenticity tokens" do
0
@@ -122,7 +122,7 @@ describe "click_link" do
0
webrat_session.should_receive(:post).with("/posts", "authenticity_token" => "aa79cb354597a60a3786e7e291ed4f74d77d3a62")
0
it "should click rails javascript delete links" do
0
@@ -143,7 +143,7 @@ describe "click_link" do
0
webrat_session.should_receive(:delete).with("/posts/1", {})
0
it "should click rails javascript post links" do
0
@@ -159,7 +159,7 @@ describe "click_link" do
0
webrat_session.should_receive(:post).with("/posts", {})
0
it "should click rails javascript post links without javascript" do
0
@@ -175,7 +175,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/posts", {})
0
click_link "Posts", :javascript => false
0
it "should click rails javascript put links" do
0
@@ -196,7 +196,7 @@ describe "click_link" do
0
webrat_session.should_receive(:put).with("/posts", {})
0
it "should fail if the javascript link doesn't have a value for the _method input" do
0
@@ -213,12 +213,12 @@ describe "click_link" do
0
return false;">Link</a>
0
}.should raise_error(Webrat::WebratError)
0
it "should assert valid response" do
0
@@ -228,7 +228,7 @@ describe "click_link" do
0
webrat_session.response_code = 501
0
lambda { click_link "Link text" }.should raise_error(Webrat::PageLoadError)
0
[200, 300, 400, 499].each do |status|
0
it "should consider the #{status} status code as success" do
0
@@ -236,23 +236,24 @@ describe "click_link" do
0
<a href="/page">Link text</a>
0
+ webrat_session.stub!(:redirect? => false)
0
webrat_session.response_code = status
0
lambda { click_link "Link text" }.should_not raise_error
0
it "should fail is the link doesn't exist" do
0
<a href="/page">Link text</a>
0
click_link "Missing link"
0
}.should raise_error(Webrat::NotFoundError)
0
it "should not be case sensitive" do
0
@@ -262,7 +263,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page", {})
0
it "should match link substrings" do
0
@@ -272,7 +273,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page", {})
0
it "should work with elements in the link" do
0
@@ -282,7 +283,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page", {})
0
it "should match the first matching link" do
0
@@ -293,7 +294,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page1", {})
0
it "should choose the shortest link text match" do
0
@@ -301,22 +302,22 @@ describe "click_link" do
0
<a href="/page2">Link</a>
0
webrat_session.should_receive(:get).with("/page2", {})
0
it "should treat non-breaking spaces as spaces" do
0
<a href="/page1">This is a link</a>
0
webrat_session.should_receive(:get).with("/page1", {})
0
click_link "This is a link"
0
it "should not match on non-text contents" do
0
@@ -325,12 +326,12 @@ describe "click_link" do
0
<a href="/page2">Location</a>
0
webrat_session.should_receive(:get).with("/page2", {})
0
it "should click link within a selector" do
0
@@ -340,7 +341,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page2", {})
0
click_link_within "#container", "Link"
0
@@ -366,7 +367,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page/sub", {})
0
click_link "Jump to sub page"
0
it "should follow fully qualified local links" do
0
webrat_session.stub!(:current_url => "/page")
0
@@ -377,7 +378,7 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("http://subdomain.example.com/page/sub", {})
0
click_link "Jump to sub page"
0
it "should follow fully qualified local links to example.com" do
0
@@ -398,28 +399,28 @@ describe "click_link" do
0
webrat_session.should_receive(:get).with("/page?foo=bar", {})
0
click_link "Jump to foo bar"
0
it "should matches_text? on regexp" do
0
pending "need to update these"
0
link = Webrat::Link.new(webrat_session, nil)
0
link.should_receive(:text).and_return(@link_text_with_nbsp)
0
link.matches_text?(/link/i).should == 0
0
it "should matches_text? on link_text" do
0
pending "need to update these"
0
link = Webrat::Link.new(webrat_session, nil)
0
link.should_receive(:text).and_return(@link_text_with_nbsp)
0
link.matches_text?("Link Text").should == 0
0
it "should matches_text? on substring" do
0
pending "need to update these"
0
link = Webrat::Link.new(webrat_session, nil)
0
link.should_receive(:text).and_return(@link_text_with_nbsp)
0
link.matches_text?("nk Te").should_not be_nil
0
it "should not matches_text? on link_text case insensitive" do
0
pending "need to update these"
0
link = Webrat::Link.new(webrat_session, nil)
0
@@ -428,15 +429,15 @@ describe "click_link" do
0
link.should_receive(:title).and_return(nil)
0
link.matches_text?("link_text").should == false
0
it "should match text not include " do
0
pending "need to update these"
0
link = Webrat::Link.new(webrat_session, nil)
0
link.should_receive(:text).and_return('LinkText')
0
link.matches_text?("LinkText").should == 0
0
- it "should not matches_text? on wrong text" do
0
+ it "should not matches_text? on wrong text" do
0
pending "need to update these"
0
link = Webrat::Link.new(webrat_session, nil)
0
nbsp = [0xA0].pack("U")
0
@@ -464,5 +465,5 @@ describe "click_link" do
0
link.should_receive(:inner_html).and_return('<img src="logo.png" />')
0
link.matches_text?('logo.png').should == 10