Philipp Engel
2007-Aug-03 10:29 UTC
[rspec-users] more different predicates (not only should)?
Hello, I am using rspec in a project and would like to know if you have thought about adding a feature. RSpec as I know it currently only knows about the predicate ''should''. What I have in mind would look something like this: it :should "have a valid name" now should is not part of the spec text, but a symbol. Then you could think of things like that: it :must "have a valid name" it :shall "have a valid name" so you can define some criticality, and if specs fail, you know what has a higher priority. Also, there could be a predicate that allows you to write down spec for future versions that do not have to work and are not shown when running the test in normal mode it :in_future_version_must "have a valid name" or something like that. Is something like that already planned or, if not, what do you think about a feature like this?
Scott Taylor
2007-Aug-03 10:49 UTC
[rspec-users] more different predicates (not only should)?
On Aug 3, 2007, at 6:29 AM, Philipp Engel wrote:> Hello, > > I am using rspec in a project and would like to know if you have > thought about adding a feature. > RSpec as I know it currently only knows about the predicate ''should''. > What I have in mind would look something like this: > > it :should "have a valid name" > > now should is not part of the spec text, but a symbol. Then you > could think of things like that: > > it :must "have a valid name" > it :shall "have a valid name" > > so you can define some criticality, and if specs fail, you know > what has a higher priority. Also, there could be a predicateWhat would be the different levels of priority, and how would they be rated? As far as I''ve been doing it, BDD usually encourages example specification => implementing the spec => refactoring, and then repeating the process until your feature set is where you want it to be. Usually the only time a bunch of specs will fail is when you are doing some major refactoring, and so usually I look to refactor in a different way. From what I understand, there was once a time (long ago, something like pre v. 0.1) when these three names were all being considered as equals. Should won, and must lost.> that allows you to write down spec for future versions that do not > have to work and are not shown when running the test in normal mode > > it :in_future_version_must "have a valid name" > > or something like that.yep. That''s the unimplemented spec. Don''t provide a block, and the runner will let you know that the feature hasn''t been implemented. So your example would be: it "should have a valid name" New on trunk is also the pending() method, which allows you to write the desired behaviour without it being implemented. It considers the spec as an unimplemented spec. Best, Scott