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:
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:
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.