I am using Cheezy’s PageObject to setup some cucumber tests. I have everything pretty much setup like Jeff Morgan’s book “Cucumber & Cheese”.
Right now I have a page object “PublishPage” setup that has a method that sets a variable @tag. For example I have in the file publish_page.rb
Class PublishPage
def tag
#some steps left out
@tag = "123"
end
def verify_tag
#some steps left out
@tag.should include "2"
end
end
In the Cucumber steps, for one of the steps i have on_page(PublishPage).tag, and then in another step i have on_page(PublishPage).verify_tag. In my env.rb file I have require 'rspec-expectations'.
The problem is that when I run this code I get an error that says undefined method 'include' for #<PublishPage:xxxxxx>. But if I move the code inside the verify_tag method into the steps everything works except it does not have access to @tag…
This should be as simple as adding
to your page object.
The other alternative would be to expose
@tagthrough some method and then in your Cucumber step say something like