On 23 November 2011 16:32, Graham Ashton <span dir="ltr"><<a href="mailto:graham@effectif.com">graham@effectif.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<div bgcolor="#FFFFFF"><div>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).</div></div></blockquote>
<div><br></div><div>The best example I can think of is<div>ActiveSupport's<b> OrderedHash.</b><div><br></div><div>Originally it was implemented as a subclass of <b>Array</b>,</div><div>We could have said "there's no point in testing the Array stuff"</div>
<div>And just have tests on the stuff that made it look like a Hash.</div><div><br></div><div>But then,</div><div>in Rails 2.1 (around then) it became a subclass of<b> Hash</b>.</div><div><br></div><div>The API was exactly the same,</div>
<div>the *behaviour* was exactly the same,</div><div>but the underlying implementation was suddenly the opposite.</div></div></div>