Tag name for nodes

This commit is contained in:
Jonas Nicklas 2009-11-05 15:10:18 +01:00
parent 286c81f584
commit cbe0153950
3 changed files with 16 additions and 0 deletions

View File

@ -20,6 +20,12 @@ class Webcat::Driver::Culerity
def click
node.click
end
def tag_name
# FIXME: this might be the dumbest way ever of getting the tag name
# there has to be something better...
node.to_xml[/^\s*<([a-z0-9\-\:]+)/, 1]
end
end
attr_reader :app, :rack_server

View File

@ -15,6 +15,10 @@ class Webcat::Driver::RackTest
def click
session.visit(attribute(:href))
end
def tag_name
node.node_name
end
end
include ::Rack::Test::Methods

View File

@ -45,6 +45,12 @@ shared_examples_for 'driver' do
@driver.find('//a')[1].attribute(:id).should == 'foo'
@driver.find('//a')[1].attribute(:rel).should be_nil
end
it "should extract node tag name" do
@driver.find('//a')[0].tag_name.should == 'a'
@driver.find('//a')[1].tag_name.should == 'a'
@driver.find('//p')[1].tag_name.should == 'p'
end
end
end