David Chelimsky
2009-Jul-15 22:21 UTC
[rspec-users] Should deleting code require failing specs?
On Wed, Jul 15, 2009 at 5:03 PM, Adam Anderson<adamandersonis at gmail.com> wrote:> Sometimes when features are asked to be removed it doesn''t make sense to > specify that they shouldn''t be there. It seems to me that removing something > from a tested app should not entail writing a failing spec for that change. > I''m curious if people have different opinions or insights on this. > > -AdamI''d generally not spec the absence of a pre-existing feature, but I think it depends on the nature of the app and the associated risk of clients (human or other systems) trying to access services that no longer exist.
Stephen Eley
2009-Jul-16 15:35 UTC
[rspec-users] Should deleting code require failing specs?
On Wed, Jul 15, 2009 at 6:03 PM, Adam Anderson<adamandersonis at gmail.com> wrote:> Sometimes when features are asked to be removed it doesn''t make sense to > specify that they shouldn''t be there. It seems to me that removing something > from a tested app should not entail writing a failing spec for that change. > I''m curious if people have different opinions or insights on this.I''d think about the following: * Is the *absence* of the feature a new functional requirement? * Would the existence of the feature after it''s not supposed to be there any more have an impact on users or other stakeholders? * Is removing the feature likely to be problematic for any reason? * Is it at all possible that the way you deploy code could cause the feature -- or part of the feature -- to be there when it shouldn''t be? (This is usually a "yes." Even if you''re doing an online app with cookie-cutter Git and Capistrano deployment, someone could forget to merge the right branch, or leave "drop table" migrations dangling, or whatever.) You want to spec things that matter. If it *matters* that something goes away in a predictable manner, and there''s any possibility that it might not, it''s probably worthwhile to write specs for it. If the reason you''re removing it is just because no one''s using it and no one cares... *shrug* Then you''re not obliged to care more than anybody else does. >8-> -- Have Fun, Steve Eley (sfeley at gmail.com) ESCAPE POD - The Science Fiction Podcast Magazine http://www.escapepod.org
Matt Wynne
2009-Jul-16 22:06 UTC
[rspec-users] Should deleting code require failing specs?
On 15 Jul 2009, at 23:03, Adam Anderson wrote:> Sometimes when features are asked to be removed it doesn''t make > sense to specify that they shouldn''t be there. It seems to me that > removing something from a tested app should not entail writing a > failing spec for that change. I''m curious if people have different > opinions or insights on this.I think it depends on whether there''s a chance the change you''re making to remove the feature could regress somehow. If you feel the need to hem that potential regression in with a test then do it. If you''re just chopping off loose code that nobody cares about anymore, chop if off and move on. cheers, Matt +447974 430184 matt at mattwynne.net http://mattwynne.net