Submitting a Custom Matcher: gem or other method?

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.

Thanks
Ed


Ed Howland

http://twitter.com/ed_howland

On Sun, Dec 27, 2009 at 2:03 PM, Ed Howland [email protected]
wrote:

If they are not, you get a context diff right to the element level.

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

On Mon, Dec 28, 2009 at 11:27 AM, David C. [email protected]
wrote:

actual_xml.should be_functionally_eql(“<xmlstring … >”)
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,

Yes it does. That was my plan, to add a gem to my github account. I’ll
search out other DSLs for RSpec and see how they packaged them as a
gem. I imagine the easiest way to use it is to add the require to
spec_helper.rb (assuming you have one) and then call the
be_functionally_eql in your specs as normal.

Thanks,

And Happy New Year!
Ed

http://twitter.com/ed_howland


Ed Howland

http://twitter.com/ed_howland

On Tue, Dec 29, 2009 at 4:28 AM, Ashley M.
<[email protected]

wrote:

On 28 Dec 2009, at 16:27, David C. wrote:

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.

A standard location for RSpec matchers would be pretty handy though, WDYT?

First, I have no cycles to start setting something up like this for a
while
now. I’m trying to wrap up the loose ends on the book and get it to
production. After that, any spare time I have is going to be devoted to
getting the rspec-2.0 and rspec-rails-2.0 (for rails-3.0) projects
rolling
in earnest.

That said, I definitely think we need a home for information about
matchers.
Hosting them, however, is something I’d rather leave to the
professionals :slight_smile:

I’ve imagined a website where folks can list info about matcher
libraries
and others can comment and possibly vote on them. If anybody wants to
volunteer to drive this in the short run, that would be great, but I
won’t
be able to do it myself for several months.

Cheers,
David

On 28 Dec 2009, at 16:27, David C. wrote:

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.

A standard location for RSpec matchers would be pretty handy though,
WDYT?


http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran

On Tue, Dec 29, 2009 at 9:53 AM, Ed Howland [email protected]
wrote:

Cheers,

I started http://wiki.github.com/dchelimsky/rspec/matcher-libraries.
Please
feel free to modify/add.

Ed

On Tue, Dec 29, 2009 at 10:09 AM, David C. [email protected]
wrote:

On Tue, Dec 29, 2009 at 4:28 AM, Ashley M.
[email protected] wrote:

On 28 Dec 2009, at 16:27, David C. wrote:

First, I have no cycles to start setting something up like this for a while
now. I’m trying to wrap up the loose ends on the book and get it to
production. After that, any spare time I have is going to be devoted to
getting the rspec-2.0 and rspec-rails-2.0 (for rails-3.0) projects rolling
in earnest.

Good luck on the book. I am eager to buy it!

That said, I definitely think we need a home for information about matchers.
Hosting them, however, is something I’d rather leave to the professionals :slight_smile:
I’ve imagined a website where folks can list info about matcher libraries
and others can comment and possibly vote on them. If anybody wants to
volunteer to drive this in the short run, that would be great, but I won’t
be able to do it myself for several months.
Cheers,
David

Just a suggestion, several other projects have contributions listed on
their Git hub wiki. Can we create a page for them, linking to other
Github accounts. I don’t knoe about voting and such, but it might be a
start. The rspec.info page can just link to the Github wiki for a user
submitted contributions page and people can go from there. Thereby
offloading the responsibility.

If I can help help in any way, let me know.

Ed


Ed Howland

http://twitter.com/ed_howland

On 30 Dec 2009, at 22:31, Ashley M. wrote:

Wasn’t expecting you to drop everything and build a matcher hosting
platform :slight_smile:

I think he should. It is Christmas, and it’s not like David ever does
anything else for the community :wink:

cheers,
Matt

+447974 430184

On 29 Dec 2009, at 15:59, David C. wrote:

I started http://wiki.github.com/dchelimsky/rspec/matcher-libraries. Please feel free to modify/add.

I like! A wiki solves 90% of problems like this with 2% of the effort.
I hadn’t realised the wiki had moved along - unlike Cucumber, I still
see the static site as the primary reference.

Wasn’t expecting you to drop everything and build a matcher hosting
platform :slight_smile:

Cheers
Ashley


http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran