[LRUG] A question on DRYness on testing methods that get / set state

Matthew Rudy Jacobs matthewrudyjacobs at gmail.com
Wed Nov 23 01:09:19 PST 2011


On 23 November 2011 16:32, Graham Ashton <graham at effectif.com> wrote:
>
> So if we were using attr_* to implement the feature (I realise it's a
> contrived example) I'd skip the test entirely as I'd just be testing Ruby
> (which is pointless).
>

The best example I can think of is
ActiveSupport's* OrderedHash.*

Originally it was implemented as a subclass of *Array*,
We could have said "there's no point in testing the Array stuff"
And just have tests on the stuff that made it look like a Hash.

But then,
in Rails 2.1 (around then) it became a subclass of* Hash*.

The API was exactly the same,
the *behaviour* was exactly the same,
but the underlying implementation was suddenly the opposite.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20111123/56f57599/attachment.html>


More information about the Chat mailing list