To ensure the following html exists on a page
<div id="party">
Gizmo Party
</div>
on_page_with :gizmo_party do |page|
page.should have_party
page.party_text.should == "Gizmo Party"
end
The page mixin would be the following
module PageWithGizmoParty
def has_party?
@document.xpath(party_selector) > 0
end
def party_text
@document.xpath(party_selector).inner_text
end
private
def party_selector
"//div[@id=party]"
end
end
This the way I have being using page models thus far.
Look at OpenSruct closure style on github for a more elegent examples.
:)
Steven