[rspec-users] Submitting a Custom Matcher: gem or other method?

David Chelimsky dchelimsky at gmail.com
Mon Dec 28 11:27:30 EST 2009


On Sun, Dec 27, 2009 at 2:03 PM, Ed Howland <ed.howland at gmail.com> wrote:

> Hi, I have a custom matcher that I call XMLDiff that takes an actual
> XML string and an expected one and uses RSpec's normal line differ to
> show the difference at the node level. It uses a method called
> be_functionaly_eql, because two XML strings can be the same regardless
> of whitespece. I.e. they are functionaly equivalent. If you ran both
> through the same parser, they would (should) result in the same
> behavior. So:
>
>  actual_xml.should be_functionally_eql("<xmlstring ... >")
>
> If they are not, you get a context diff right to the element level.
> Useful for finding errors in long XML strings.
>
> I have searched for such a thing to no avail. There may be other
> solutions and I;d be interested in seeing them. But this is what I
> came up with.
>
> The question is, how would you recommend sharing it? I am new to
> gem-ing, but can it be packaheged that way, or is there some other
> method for sharing custom matchers? I can host it on Github, if that
> is a recommended way to do so.
>

For most users, gems are the easiest answer. By all means, host source on
github if you want people to contribute, or have a place to inspect code,
but you don't need a public source repository in order to push gems to
gemcutter.

HTH,
David


> Thanks
> Ed
>
>
> --
> Ed Howland
> http://greenprogrammer.wordpress.com
> http://twitter.com/ed_howland
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091228/22a138b9/attachment.html>


More information about the rspec-users mailing list