Testing image_tag :src (asset id issue)

This seems like it should be real easy to do but I have not found any documentation:

I have an image tag in a page:

<%= image_tag “arrow_green.gif”, :alt => “image did not load” %>

And a functional test I would like to write:

assert_tag :tag => “img”, :attributes => { :src => “arrow_green.gif” }

Of course, rails return the asset id at the end, so the test fails:

expected tag, but no tag found matching {:tag=>“img”, :attributes=>{:src=>“arrow_green.giv”}} in…

So is there a way to write a test for this? I know I can use an :alt property and test that, but I really would rather test the :src. Any way to get the asset id within the test so I could write:

assert_tag :tag => “img”, :attributes => { :src => “arrow_green.gif” + asset_id }

Mess around with...

  ActionView::Helpers::AssetTagHelper.cache_asset_timestamps = false

DK wrote:

This seems like it should be real easy to do but I have not found any
documentation:

I have an image tag in a page:

<%= image_tag "arrow_green.gif", :alt => "image did not load" %>

Slightly off your question, but...that's a terrible abuse of the alt
attribute. It should have text that can take the place of the image in
non-graphical browsers. "Image die not load" is inappropriate alt
content and is dealt with by the browser in any case.