[rspec-devel] [ rspec-Bugs-8887 ] Should have RJS matches DOM IDs as substrings

noreply at rubyforge.org noreply at rubyforge.org
Mon Feb 26 12:09:43 EST 2007


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

>Category: rails plugin
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 3
Submitted By: Ashley Moran (ashley_moran)
>Assigned to: David Chelimsky (dchelimsky)
Summary: Should have RJS matches DOM IDs as substrings

Initial Comment:
In RSpec 0.7.5.1, given:
    <div id="my_div" />

and RJS to insert a partial at the bottom of the div, the following spec passes:
    response.should_have_rjs :insert_html, :bottom, "my_div"

but so does this:
    response.should_have_rjs :insert_html, :bottom, "y_di"

because the string "y_di" is a substring of the ID.


Is this intended?  To create robust specs, you need to do this:
  response.should_have_rjs :insert_html, :bottom, /^my_div$/

which seems unintuitive.

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

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-02-26 17:09

Message:
should_have_rjs wraps a port of ARTS. This is how ARTS works.

Additionally, should_have_rjs is deprecated in favor of "should have_rjs" (no underscore between should and have), which is in the current trunk, in 0.8.0-RC1, and will be part of the 0.8 release, so we won't be making this change to improve "should_have_rjs".

"should have_rjs" wraps assert_select and will behave as you suggest that it should.

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

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


More information about the rspec-devel mailing list