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)
|
Restore SSL support for Rails (See 73d3b72108254c0f1ad00e63f8e712115cc8ca7c)
|
||||||
Full support for multiple forms on a page
|
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
|
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
|
@element = element
|
||||||
end
|
end
|
||||||
|
|
||||||
def click(method = nil, options = {})
|
def click(options = {})
|
||||||
method ||= http_method
|
method = options[:method] || http_method
|
||||||
return if href =~ /^#/ && method == :get
|
return if href =~ /^#/ && method == :get
|
||||||
|
|
||||||
options[:javascript] = true if options[:javascript].nil?
|
options[:javascript] = true if options[:javascript].nil?
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Logging
|
module Logging
|
||||||
|
|
||||||
|
def warn_log(message) # :nodoc:
|
||||||
|
return unless logger
|
||||||
|
logger.warn message
|
||||||
|
end
|
||||||
|
|
||||||
def debug_log(message) # :nodoc:
|
def debug_log(message) # :nodoc:
|
||||||
return unless logger
|
return unless logger
|
||||||
logger.debug message
|
logger.debug message
|
||||||
|
@ -113,7 +113,7 @@ module Webrat
|
|||||||
#
|
#
|
||||||
# clicks_link "Sign up", :javascript => false
|
# clicks_link "Sign up", :javascript => false
|
||||||
def clicks_link(link_text, options = {})
|
def clicks_link(link_text, options = {})
|
||||||
find_link(link_text).click(nil, options)
|
find_link(link_text).click(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :click_link, :clicks_link
|
alias_method :click_link, :clicks_link
|
||||||
@ -123,7 +123,7 @@ module Webrat
|
|||||||
# Example:
|
# Example:
|
||||||
# clicks_get_link "Log out"
|
# clicks_get_link "Log out"
|
||||||
def clicks_get_link(link_text)
|
def clicks_get_link(link_text)
|
||||||
find_link(link_text).click(:get)
|
clicks_link link_text, :method => :get
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :click_get_link, :clicks_get_link
|
alias_method :click_get_link, :clicks_get_link
|
||||||
@ -133,7 +133,7 @@ module Webrat
|
|||||||
# Example:
|
# Example:
|
||||||
# clicks_delete_link "Log out"
|
# clicks_delete_link "Log out"
|
||||||
def clicks_delete_link(link_text)
|
def clicks_delete_link(link_text)
|
||||||
find_link(link_text).click(:delete)
|
clicks_link link_text, :method => :delete
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :click_delete_link, :clicks_delete_link
|
alias_method :click_delete_link, :clicks_delete_link
|
||||||
@ -143,7 +143,7 @@ module Webrat
|
|||||||
# Example:
|
# Example:
|
||||||
# clicks_post_link "Vote"
|
# clicks_post_link "Vote"
|
||||||
def clicks_post_link(link_text)
|
def clicks_post_link(link_text)
|
||||||
find_link(link_text).click(:post)
|
clicks_link link_text, :method => :post
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :click_post_link, :clicks_post_link
|
alias_method :click_post_link, :clicks_post_link
|
||||||
@ -153,7 +153,7 @@ module Webrat
|
|||||||
# Example:
|
# Example:
|
||||||
# clicks_put_link "Update profile"
|
# clicks_put_link "Update profile"
|
||||||
def clicks_put_link(link_text)
|
def clicks_put_link(link_text)
|
||||||
find_link(link_text).click(:put)
|
clicks_link link_text, :method => :put
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :click_put_link, :clicks_put_link
|
alias_method :click_put_link, :clicks_put_link
|
||||||
|
@ -18,7 +18,7 @@ describe "clicks_link" do
|
|||||||
<a href="/page">Link text</a>
|
<a href="/page">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.should_receive(:get).with("/page", {})
|
@session.should_receive(:get).with("/page", {})
|
||||||
@session.clicks_get_link "Link text"
|
@session.clicks_link "Link text", :method => :get
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should click delete links" do
|
it "should click delete links" do
|
||||||
@ -26,7 +26,7 @@ describe "clicks_link" do
|
|||||||
<a href="/page">Link text</a>
|
<a href="/page">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.should_receive(:delete).with("/page", {})
|
@session.should_receive(:delete).with("/page", {})
|
||||||
@session.clicks_delete_link "Link text"
|
@session.clicks_link "Link text", :method => :delete
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ describe "clicks_link" do
|
|||||||
<a href="/page">Link text</a>
|
<a href="/page">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.should_receive(:post).with("/page", {})
|
@session.should_receive(:post).with("/page", {})
|
||||||
@session.clicks_post_link "Link text"
|
@session.clicks_link "Link text", :method => :post
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should click put links" do
|
it "should click put links" do
|
||||||
@ -43,7 +43,7 @@ describe "clicks_link" do
|
|||||||
<a href="/page">Link text</a>
|
<a href="/page">Link text</a>
|
||||||
EOS
|
EOS
|
||||||
@session.should_receive(:put).with("/page", {})
|
@session.should_receive(:put).with("/page", {})
|
||||||
@session.clicks_put_link "Link text"
|
@session.clicks_link "Link text", :method => :put
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should click rails javascript links with authenticity tokens" do
|
it "should click rails javascript links with authenticity tokens" do
|
||||||
|
Loading…
Reference in New Issue
Block a user