Guice dependency injection for Jnario Specs
Just annotate your Spec class with
@CreateWith(GuiceSpecCreator)
and optionally specify a Guice module using
@InjectWith(MyModule)
Now you can use the @Inject annotation in your spec.
@CreateWith(GuiceSpecCreator)
@InjectWith(EnglishModule)
describe Greeter "Interface Injection" {
@Inject
Greeter injected
fact "the subject is injected by Guice" {
subject.greet should be "Hello"
}
fact "spec variables are injected by Guice" {
injected.greet should be "Hello"
}
}