[rspec-users] more different predicates (not only should)?

Scott Taylor mailing_lists at railsnewbie.com
Fri Aug 3 06:49:49 EDT 2007

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 predicate

What would be the different levels of priority, and how would they be  

As far as I've been doing it, BDD usually encourages example  
specification =>
implementing the spec => refactoring, and then repeating the process  
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  
will let you know that the feature hasn't been implemented.  So your  
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.



More information about the rspec-users mailing list