[rspec-devel] [Rspec-users] String.should_hav_tag

David Chelimsky dchelimsky at gmail.com
Wed Oct 4 13:34:23 EDT 2006

On 10/4/06, Micah Martin <micah at 8thlight.com> wrote:
> I've just upgraded to rspec 0.6.4 and several specs were broken.  All for
> the same reason.  String.should_have_tag doesn't seem to be supported any
> longer.
> It used to be possible to write assertions like:
> response.body.should_have_tag :tag => "form"
> or
> "<html><body/></html>".should_have_tag :tag => "body"
> But these fail with 0.6.4.  The documentation still suggests this should
> work.
> I was able to solve the problem by adding the following to my spec files:
> class String
>   include Spec::Expectations::TagExpectations
> end

Doh! Thanks for pointing this out Micah. This changed in this release
and I neglected to point it out in the release notes.

As of 0.6.4, instead of using this:


you should use this:


(see http://rspec.rubyforge.org/documentation/rails/rails.html)

Micah's suggestion above will work in the short run, but I would
recommend that you change the specs. In the next release (0.6.5) there
will no longer be a module named Spec::Expectations::TagExpectations.


ps - sorry for the inconvenience. It is our intent to NOT break
backwards compatibility on any minor (0.6.x) releases or without any

More information about the rspec-devel mailing list