specta/specta — pull request #48 by AgileMantis (2013-10-22 18:52:53+00:00)
Title: Added capability to assign block results to keys for use inside examples...

Please let me know if this feature is of interest. In order to dry-up code across multiple examples, I added an `assign` function which takes a block and assigns its results to a key. The result can then be re-accessed from within any example, or nested example group/example. This is along the lines of RSPec's `let`.

````
describe(@"assign", ^{

assign(@"foo", ^{ return @"bar"; });

it(@"accesses assgined block return value", ^{
NSString *foo = getAssign(@"foo");
expect(foo).toEqual(@"bar");
});

});
````

If this is of interest, I can add block result memoization.

FYI. In order to get this working, and especially with nesting, I had to:
- Add a reference to a parent ExampleGroup to Example
- Add a reference to the currently executing example to the Spec (SPT_getCurrentExample didn't seem to work).

Thanks
b