Better inspect output for Webrat elements
This commit is contained in:
parent
2d427ed89e
commit
a5e6af2fe7
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
* Minor enhancements
|
* Minor enhancements
|
||||||
|
|
||||||
|
* Better inspect output for Webrat elements
|
||||||
* Detect if the document is XML or HTML using the Content-Type when in Rails mode
|
* Detect if the document is XML or HTML using the Content-Type when in Rails mode
|
||||||
* Expose #selenium method for direct access to Selenium client
|
* Expose #selenium method for direct access to Selenium client
|
||||||
* Check nokogiri gem version before requiring nokogiri
|
* Check nokogiri gem version before requiring nokogiri
|
||||||
|
@ -24,6 +24,10 @@ module Webrat
|
|||||||
Webrat::XML.xpath_to(@element)
|
Webrat::XML.xpath_to(@element)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def inspect
|
||||||
|
"#<#{self.class} @element=#{element.inspect}>"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
@ -1,6 +1,20 @@
|
|||||||
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
||||||
|
|
||||||
module Webrat
|
module Webrat
|
||||||
|
describe Field do
|
||||||
|
it "should have nice inspect output" do
|
||||||
|
html = <<-HTML
|
||||||
|
<html>
|
||||||
|
<input type='checkbox' checked='checked' />
|
||||||
|
</html>
|
||||||
|
HTML
|
||||||
|
|
||||||
|
element = Webrat::XML.css_search(Webrat::XML.document(html), "input").first
|
||||||
|
checkbox = CheckboxField.new(nil, element)
|
||||||
|
checkbox.inspect.should =~ /#<Webrat::CheckboxField @element=<input type=['"]checkbox['"] checked=['"]checked['"]\/>>/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe CheckboxField do
|
describe CheckboxField do
|
||||||
it "should say it is checked if it is" do
|
it "should say it is checked if it is" do
|
||||||
html = <<-HTML
|
html = <<-HTML
|
||||||
|
Loading…
Reference in New Issue
Block a user