[rspec-devel] [ rspec-Bugs-11602 ] Nested #have_tag specifications fails on the wrong line number

noreply at rubyforge.org noreply at rubyforge.org
Sat Jun 16 07:41:24 EDT 2007


Bugs item #11602, was opened at 2007-06-15 17:28
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11602&group_id=797

Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: François Beausoleil (fbos)
Assigned to: Nobody (None)
Summary: Nested #have_tag specifications fails on the wrong line number

Initial Comment:
Ouch...  I just spent two hours on this, to finally find that the bug wasn't what I thought at all...

I had the following specification (Rails View):
  response.should have_tag("a[href$=?]", download_asset_path(@asset)) do
    with_tag "img[src=?]", download_asset_path(@asset)
    with_tag "img[width=200]"
    with_tag "img[height=212]"
    with_tag "img[alt=?]", @asset.title
  end

RSpec was reporting a spec failure on the first line above.  After 2 hours of investigation, test reformulating and all, I finally found that the correction was this:

  response.should have_tag("a[href$=?]", download_asset_path(@asset)) do
    with_tag "img[src=?]", download_asset_path(@asset)
    with_tag "img[width=?]", @asset.height
    with_tag "img[height=?]", @asset.height
    with_tag "img[alt=?]", @asset.title
  end

No more errors.  And sure enough:
    with_tag "img[width=?]", @asset.height

again reports the failure against the "response.should have_tag" line.

This is with RSpec 1.0.4.

Bye !
François

----------------------------------------------------------------------

>Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-06-16 07:41

Message:
Please attach the whole stack trace, both with and without -b. Also, please attach the files so we can see the line numbers.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11602&group_id=797


More information about the rspec-devel mailing list