Rails 2 / Rails 3 matchers where the underlying Rails implementations have shifted radically...

2 views
Skip to first unread message

Matt Patterson

unread,
Jun 16, 2010, 12:31:14 PM6/16/10
to shoulda
I have a couple of matchers I wrote for the now long-abandoned rspec-
on-rails-matchers gem, which allow declarative testing of whether
controller filters will run, and which I've continued using alongside
Shoulda. I thought it was about time I looked at whether I could offer
these to the Shoulda community, so I've forked and branched... And now
I'm wondering if there's an (emerging or otherwise) consensus on how
to deal with matchers which need a radically different implementation
in Rails 2 and Rails 3.

Cheers,

Matt

Joe Ferris

unread,
Jun 18, 2010, 9:45:16 AM6/18/10
to shoulda
Hey Matt,

For now, we've kept the existing matchers working with both Rails 2.3
and Rails 3. There were a few matchers that had to change drastically
(filter_params, for example). In those cases, we've added conditional
logic in the matchers where appropriate. We even have two rails roots
in the shoulda test suite for now.

I'd be more open to having new matchers that only work with Rails 3,
since people aren't already depending on them in their existing test
suites. They'd only have to upgrade if they wanted the latest and
greatest.

-Joe

Matt Patterson

unread,
Jun 25, 2010, 9:40:09 AM6/25/10
to shoulda
On Jun 18, 2:45 pm, Joe Ferris <joe.r.fer...@gmail.com> wrote:
> Hey Matt,
>
> For now, we've kept the existing matchers working with both Rails 2.3
> and Rails 3. There were a few matchers that had to change drastically
> (filter_params, for example). In those cases, we've added conditional
> logic in the matchers where appropriate.

Cool. I was wondering if there was a house style for that... I've
added a matcher I had created for a different project which has a more
explicit view of dealing with the Rails 2 / Rails 3 problem. I filed a
ticket about it with a link to the branch on my fork --
http://github.com/thoughtbot/shoulda/issues/106 .

> We even have two rails roots in the shoulda test suite for now.

How's that working? I know RSpec have taken a very different route to
achieving (broadly) the same thing.

Matt
Reply all
Reply to author
Forward
0 new messages