Cleaning up clicks_link method options
This commit is contained in:
parent
8f401f67d5
commit
235c601922
2
TODO.txt
2
TODO.txt
|
@ -1,3 +1,5 @@
|
|||
Fix #within scoping for forms that exist outside the scope
|
||||
Figure out what the deal is with #select not working
|
||||
Restore SSL support for Rails (See 73d3b72108254c0f1ad00e63f8e712115cc8ca7c)
|
||||
Full support for multiple forms on a page
|
||||
Track the current form based on the location of the last manipulated input, use this as a default for clicks_button
|
||||
|
|
|
@ -8,8 +8,8 @@ module Webrat
|
|||
@element = element
|
||||
end
|
||||
|
||||
def click(method = nil, options = {})
|
||||
method ||= http_method
|
||||
def click(options = {})
|
||||
method = options[:method] || http_method
|
||||
return if href =~ /^#/ && method == :get
|
||||
|
||||
options[:javascript] = true if options[:javascript].nil?
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
module Webrat
|
||||
module Logging
|
||||
|
||||
def warn_log(message) # :nodoc:
|
||||
return unless logger
|
||||
logger.warn message
|
||||
end
|
||||
|
||||
def debug_log(message) # :nodoc:
|
||||
return unless logger
|
||||
|
|
|
@ -113,7 +113,7 @@ module Webrat
|
|||
#
|
||||
# clicks_link "Sign up", :javascript => false
|
||||
def clicks_link(link_text, options = {})
|
||||
find_link(link_text).click(nil, options)
|
||||
find_link(link_text).click(options)
|
||||
end
|
||||
|
||||
alias_method :click_link, :clicks_link
|
||||
|
@ -123,7 +123,7 @@ module Webrat
|
|||
# Example:
|
||||
# clicks_get_link "Log out"
|
||||
def clicks_get_link(link_text)
|
||||
find_link(link_text).click(:get)
|
||||
clicks_link link_text, :method => :get
|
||||
end
|
||||
|
||||
alias_method :click_get_link, :clicks_get_link
|
||||
|
@ -133,7 +133,7 @@ module Webrat
|
|||
# Example:
|
||||
# clicks_delete_link "Log out"
|
||||
def clicks_delete_link(link_text)
|
||||
find_link(link_text).click(:delete)
|
||||
clicks_link link_text, :method => :delete
|
||||
end
|
||||
|
||||
alias_method :click_delete_link, :clicks_delete_link
|
||||
|
@ -143,7 +143,7 @@ module Webrat
|
|||
# Example:
|
||||
# clicks_post_link "Vote"
|
||||
def clicks_post_link(link_text)
|
||||
find_link(link_text).click(:post)
|
||||
clicks_link link_text, :method => :post
|
||||
end
|
||||
|
||||
alias_method :click_post_link, :clicks_post_link
|
||||
|
@ -153,7 +153,7 @@ module Webrat
|
|||
# Example:
|
||||
# clicks_put_link "Update profile"
|
||||
def clicks_put_link(link_text)
|
||||
find_link(link_text).click(:put)
|
||||
clicks_link link_text, :method => :put
|
||||
end
|
||||
|
||||
alias_method :click_put_link, :clicks_put_link
|
||||
|
|
|
@ -18,7 +18,7 @@ describe "clicks_link" do
|
|||
<a href="/page">Link text</a>
|
||||
EOS
|
||||
@session.should_receive(:get).with("/page", {})
|
||||
@session.clicks_get_link "Link text"
|
||||
@session.clicks_link "Link text", :method => :get
|
||||
end
|
||||
|
||||
it "should click delete links" do
|
||||
|
@ -26,7 +26,7 @@ describe "clicks_link" do
|
|||
<a href="/page">Link text</a>
|
||||
EOS
|
||||
@session.should_receive(:delete).with("/page", {})
|
||||
@session.clicks_delete_link "Link text"
|
||||
@session.clicks_link "Link text", :method => :delete
|
||||
end
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ describe "clicks_link" do
|
|||
<a href="/page">Link text</a>
|
||||
EOS
|
||||
@session.should_receive(:post).with("/page", {})
|
||||
@session.clicks_post_link "Link text"
|
||||
@session.clicks_link "Link text", :method => :post
|
||||
end
|
||||
|
||||
it "should click put links" do
|
||||
|
@ -43,7 +43,7 @@ describe "clicks_link" do
|
|||
<a href="/page">Link text</a>
|
||||
EOS
|
||||
@session.should_receive(:put).with("/page", {})
|
||||
@session.clicks_put_link "Link text"
|
||||
@session.clicks_link "Link text", :method => :put
|
||||
end
|
||||
|
||||
it "should click rails javascript links with authenticity tokens" do
|
||||
|
|
Loading…
Reference in New Issue