The problem with testing to that level is, sometimes the tag may not be 
rendered yet. Also, such tests tend to be brittle. You dont want to depend 
on things that change often, I would probably test that the product.title 
exists, regardless of what tag its wrapped in.

On Friday, December 5, 2014 2:12:36 PM UTC-5, Roelof Wobben wrote:
>
> Hello, 
>
> I want to test the contents of the p tag here : 
>
> ~~~
>
> <div class="productinfo text-center">
>                                               <%= image_tag 
> product.image_url %>
>                                               
> <h2><%=number_to_currency(product.price)%></h2>
>                                                <p> <%= product.title %>   
> </p>
>               <a href="#" class="btn btn-default add-to-cart"><i class="fa 
> fa-shopping-cart"></i>Add to cart</a>
>           </div>
>
> ~~~
>
> I tried this assert_select'.single-products.p',1 but it do not work. I get 
> 0 items found .
>
> Roelof
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/msgid/rubyonrails-talk/3f542a21-87d3-4fbc-ba4c-601ef05831b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to