[Cucumber:4318] [Webrat??] visit not visiting?

10 views
Skip to first unread message

ants

unread,
May 4, 2010, 2:36:56 PM5/4/10
to Cukes
I have tried to find a solution by googling and going through a few
pages from this mailing list, but I'm not sure exactly where to look,
being an Rspec/Cucumber newbie.

Despite the controller, model and views all being set up correctly, I
get the following error ....

Could not find link with text or title or id "Create Competiton
Type" (Webrat::NotFoundError)

With the following test ....

When /^I create a new competition type named "([^\"]*)"$/ do |
competition_type|
visit competition_types_path
click_link "Create Competiton Type"
end

Printing competition_types_path during execution just gives me /
competition_types. Does Webrat not require a host name?

I have all gems installed and am going through the RSpec book but
changing things to suit my new project.

Sorry of this is an obvious one but of someone could point me in the
right direction on the web as to where I can learn about this.

CIA

-Ants

--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.

Matt Wynne

unread,
May 4, 2010, 5:45:18 PM5/4/10
to cu...@googlegroups.com

On 4 May 2010, at 19:36, ants wrote:

> I have tried to find a solution by googling and going through a few
> pages from this mailing list, but I'm not sure exactly where to look,
> being an Rspec/Cucumber newbie.
>
> Despite the controller, model and views all being set up correctly, I
> get the following error ....
>
> Could not find link with text or title or id "Create Competiton
> Type" (Webrat::NotFoundError)
>
> With the following test ....
>
> When /^I create a new competition type named "([^\"]*)"$/ do |
> competition_type|
> visit competition_types_path

Try using this line to see what webrat can see at this point:

save_and_open_page

My guess is that your Given steps aren't getting things into the state you think they are, and that link isn't there.

ants

unread,
May 5, 2010, 4:53:15 AM5/5/10
to Cukes
> > For more options, visit this group athttp://groups.google.com/group/cukes?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/cukes?hl=en.

Okay, well as a beginner, I'm entitled not to fully understand
concepts, right? ;)

Because I thought the Given wasn't doing anything, DMA, for example, I
included the step but it was left blank and all the work was done in
the When.

I see that was wrong and will have to go back over what I've read to
see where it talks about this. With so many new concepts, ways of
thinking, it's difficult to take everythign in. Plus I'm learning
this while thinking about developing my project. So there's a lot
going on in my head.

Thanks for the pointer about Given not setting things up.

I can't get save_and_open_page to open a page. This is my env.rb

Webrat.configure do |config|
config.mode = :rails
config.open_error_files = true # Set to true if you want error pages
to pop up in the browser
end

Thanks again.

ants

unread,
May 5, 2010, 5:11:24 AM5/5/10
to Cukes
Okay, I've seen the thing I need in web_steps.rb

Then /^show me the page$/ do
save_and_open_page
end

and when adding that to my features, it told me I needed to install
the launchy gem.

I liked Cucumber/Rspec before but I'm really liking it now.

Thank you to all those that have contributed to its development.

Matt Wynne

unread,
May 5, 2010, 6:16:07 AM5/5/10
to cu...@googlegroups.com
Don't freak out! We'll be here as long as you have clear concrete questions.

I prescribe regular tea breaks to keep your brain from overflowing.

>
> Thanks for the pointer about Given not setting things up.
>
> I can't get save_and_open_page to open a page.

Why not? What happens? Did you see an error message? Are you developing on mac or linux or windows or something else?

You need to give us a little more context if you want more help.

ants

unread,
May 5, 2010, 8:04:43 AM5/5/10
to Cukes
No freaking out going on here but lots of tea. Definitely!!

I wasn't getting any error when including save_and_open_page in my
step file but when I tried the step 'show me the page', it threw up
the error about launchy.

Everything is now working.
Reply all
Reply to author
Forward
0 new messages