[rspec-users] should contain vs. =~

Brennon Bortz brennon at brennonbortz.com
Mon Sep 6 09:15:37 EDT 2010

I'm developing another view test.  Relevant example:

it "should show the item's url" do
      rendered.should contain("http://www.example.com")

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/

Am I missing something?


Brennon Bortz
Software Researcher
Dundalk Institute of Technology
brennon.bortz at casala.ie
Ph.D. Researcher & Composer - Sonic Arts Research Centre
Queen's University, Belfast
brennon at brennonbortz.com / bbortz01 at qub.ac.uk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100906/00819742/attachment-0001.html>

More information about the rspec-users mailing list