nicholas a. evans
2007-Apr-27 15:54 UTC
[rspec-users] it "should ...", encouraging "should" via it_should
On 4/27/07, David Chelimsky <dchelimsky at gmail.com> wrote:> Any other suggestions? > > In general, I''m much more inclined to favor an additional parameter > passed to #it over a new method name.Since I suggested in the other thread that perhaps during_event and on_event could append text to the spec string, here''s another similar (but simpler) suggestion that''s been in my mind for a while. it_should could automatically add "should" to the spec string. At first, the "it" syntax left me feeling a bit weird. I like that we''ve gone from context/specify to describe/it, because it reads far more naturally and there is less of the "what does a context mean, what should I be specifying" questioning. It pushes you gently in the direction of writing the specifications in a descriptive form. However, having recently worked with my coworkers to make the wholesale shift to rspec, I''ve noticed a surprising number of specs that don''t have "should" at the beginning of the spec string, and should. Now, we haven''t made the shift to 0.9 yet, so we don''t have describe/it yet either. But if the overwhelming majority of specs should include "should" as the first word, instead of it "should do such and such" why not use it_should "do such and such" For some reason, "it_should" feels a lot nicer to me than "it", but on top of that it should go an extra step towards forcing people to word their spec strings in the proper manner. At that point, the primary documentation could tell people to use "it_should", and "it" could be relegated to a dusty corner of the rspec library for people who have some strange reason for not wanting the word "should" automatically included into their spec strings (also for backwards compatibility). Thoughts? -- Nick