Crystal: Defining method definitions within spec describe blocks

Created on 2 Apr 2017  路  2Comments  路  Source: crystal-lang/crystal

Within a describe block trying to def a method returns can't declare def dynamically. I searched the source code for spec testing on defining methods in rspec style with let and it doesn't exist.

What's the rule, or standardized way to do this in spec tests?

question

Most helpful comment

The current approach is to have private def in the _spec.cr file. So they don't collide with other defs in other files. But they are global in the _spec.cr without contextual information. That is a current limitation of the built in spec.

All 2 comments

The current approach is to have private def in the _spec.cr file. So they don't collide with other defs in other files. But they are global in the _spec.cr without contextual information. That is a current limitation of the built in spec.

Closing. Using private def is the way to go for now (and I think forever)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RX14 picture RX14  路  3Comments

Papierkorb picture Papierkorb  路  3Comments

will picture will  路  3Comments

Sija picture Sija  路  3Comments

relonger picture relonger  路  3Comments