[rspec-users] should contain vs. =~

David Chelimsky dchelimsky at gmail.com
Mon Sep 6 09:55:17 EDT 2010


On Sep 6, 2010, at 8:15 AM, Brennon Bortz wrote:

> I'm developing another view test.  Relevant example:
> 
> it "should show the item's url" do
>       rendered.should contain("http://www.example.com")
> end
> 
> I'm calling render in a before block.  I have other similar examples on the page in which I'm simply using:
> 
> rendered.should =~ "..."
> 
> These all work fine, as does the first example I posted here.  However, when trying to express that first example with a regex (which I prefer), the example fails:
> 
> it "should show the item's url" do
>       rendered.should =~ /http:\/\/www.example.com/
> end
> 
> Am I missing something?

Please post the failure message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100906/38120890/attachment.html>


More information about the rspec-users mailing list