Ruby on Rails using Cucumber

Hi Everyone,

I’ve been working with cucumber trying to tests links using the scenario
outline feature of cucumber. What I want to do is have it visit the
starting_page and then click on the specified link. It should then check
to
make sure the title is correct on that page to ensure it’s on the
expected
page. Spent quite a bit of time googling without any luck.

Error I’ve been receiving:

expected css “title” to return something

(RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/managing_pages_steps.rb:11:in /^I should be able to change pages by clicking "([^"]*)" and the title is "([^"]*)"$/' features/managing_pages.feature:12:inThen I should be able to
change pages by clicking “” and the title is “”’

My code is below:
*
managing_pages.feature*

  • managing_pages_steps.rb

Given /^I am an anonymous user$/ do

response.should have_selector(‘title’, :content => “Contact”)
end

application_helper.rb

end
end

pages_controller.rb
*

class PagesController < ApplicationController
def home
@title = “Home”
end

def contact
@title = “Contact”
end
end

*layouts/application.html.erb

<%= yield %>

Any help is much appreciated!

Ya, it’s in the layout.

<%= title %> >

which uses the application helper

*application_helper.rb

end
end

which gets the @title from the pages controller

def contact

@title = "Contact"

end

On Mon, Jul 25, 2011 at 9:49 PM, Brian J. [email protected]
wrote:

expected css “title” to return something
managing_pages.feature
| / | Contact | Contact |
end
module ApplicationHelper

end
<%= csrf_meta_tag %>

Any help is much appreciated!

You’re getting this error

expected css “title” to return something
(RSpec::Expectations::ExpectationNotMetError)

Webrat is expecting a html tag. You’re usign have_selector and
you’re specifying a tagname. Do you have something like

Contact in that page?

response.should have_selector(‘title’, :content => “Contact”)


You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Leonardo M…
There’s no place like ~