My favorites | Sign in
Logo
                
Search
for
Updated May 12, 2008 by etorreborre
Labels: Featured
Troubleshooting  
Pitfalls and errors that you can avoid

This page lists tips on errors you may encounter while using specs.

  • Strange compilation error. The following spec would raise a compilation error:
  • "My Thing" should {
      "do something" {
         ...possibly long setup...
         something must ... other // matcher
      }
    }}}}
    
    This would generate:
    {{{error: type mismatch;
    [WARNING]  found   : Boolean
    [WARNING]  required: Int
This is because there is a missing "in" after the example description, so everything inside the accolade is expected to be an Int used to access one character of "do something" (see  issue 22 )

Comment by jzaugg, May 19, 2009

I was surprised when an example with no expectations was ignored.

"my example" in {
   doSomething()
   // example is ignored! This works, though: doSomething() must be_==(())
}
Comment by etorreborre, Oct 20, 2009

This behavior is indeed the default behavior and is meant at warning you that an example is not specifying any expectations. This can be overriden by changing your specs configuration: http://code.google.com/p/specs/wiki/RunningSpecs#Override_specs_default_behavior

You can also declare any piece of code to be an expectation in itself with:

doSomething.isExpectation


Sign in to add a comment
Hosted by Google Code