siyelo / should_clean

Utility to remove unneeded shoulds from your RSpec test descriptions - 'it "should do something"' becomes 'it "does something"'
MIT License
40 stars 6 forks source link

'it "should skip and jump"' becomes 'it "skips and jump"' #6

Open henrik opened 11 years ago

henrik commented 11 years ago

Haven't considered edge cases – it may well be that any simple fix creates more of a mess than it fixes. But I wanted this listed among the issues, at least, even if it will be a wontfix.

henrik commented 11 years ago

Also, it is of course a test smell to have an "and" there, but still, it's been known to happen :)

henrik commented 11 years ago

Some cases to consider:

it "should store and then destroy a foo"
it "should store a foo and a bar"
henrik commented 11 years ago

I may attempt a patch if you don't mind. A part-of-speech tagger like engtagger seems viable:

>> tgr.add_tags("it should store and then destroy a foo")
=> "<prp>it</prp> <md>should</md> <vb>store</vb> <cc>and</cc> <rb>then</rb> <vb>destroy</vb> <det>a</det> <nn>foo</nn>"
>> tgr.add_tags("should store a foo and a bar")
=> "<md>should</md> <vb>store</vb> <det>a</det> <nn>foo</nn> <cc>and</cc> <det>a</det> <nn>bar</nn>"
glennr commented 11 years ago

Patches are welcome!

On Thu, Jun 20, 2013 at 6:51 AM, Henrik Nyh notifications@github.comwrote:

I may attempt a patch if you don't mind. A part-of-speech tagger like engtagger https://github.com/yohasebe/engtagger seems viable:

tgr.add_tags("it should store and then destroy a foo") => "itshouldstoreandthendestroyafoo" tgr.add_tags("should store a foo and a bar") => "shouldstoreafooandabar"

— Reply to this email directly or view it on GitHubhttps://github.com/siyelo/should_clean/issues/6#issuecomment-19730822 .