jeremytregunna/IoSpec — pull request #1 by ticking (2011-11-02 00:43:19+00:00)
Title: Mock and DependencyInjection helper.

Usage is as follows.

Testee := Object clone do(meth := method(System version println; System activeCpus println))
t1 := Testee clone
t2 := Testee clone

For yet undefined Objects use a String for the type.

b := Mock mocking("System")
b activeCpus := 100
b version := 5

If the object already exists you can provide it directly and non overridden Methods will be invoked as usual.

m := Mock mocking(System)
m activeCpus := 100

b injectInto(t1)
m injectInto(t2)

Io> t1 meth
5
100

Io> t2 meth
20110905
100