On Tue, Feb 26, 2013 at 10:10 AM, Javix <[email protected]> wrote:
> I can't figure what is the difference betwen these 2 matchers definition:
>
> page.should have_selection('title', text: full_title('Home')) - fails, can't 
> find the title content
> page.should have_selection('title', full_title('Home')) - passes

Not sure why the first one can't find the content, but if it can't it
is failing correctly. The second one is a false positive because the
result of full_title('Home') is never evaluated by has_selector? (see
http://rubydoc.info/gems/capybara/Capybara/Node/Matchers#has_selector%3F-instance_method)

If you want any more detailed help you might want to try the Cucumber
and Capybara user lists, since those are the tools you're really
interacting with - the only thing rspec does here is translate
`have_selector` to `has_selector?`.

HTH,
David

>
> I defined the 'full_title' in ApplicationHelper:
>
> module ApplicationHelper
>   def full_title(page_title)
>     base_title = I18n.t(:base_title)
>     if page_title.empty?
>       base_title
>     else
>       "#{base_title} | #{page_title}"
>     end
>   end
> end
>
> and required in in features/env.rb to use in Cucumber:
>
> World(ApplicationHelper)
>
> In the aplication layout page the call to full_title is done as follows:
>
> <title><%= full_title(yield(:title)) %></title>
>
> And in the home/index page it is used like that:
>
> <% provide(:title, 'Home') %>
>
> Any ideas? Thank you.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "rspec" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rspec/-/0YIfTdVPrm4J.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to