Hi
I am experimenting with Constructor based dependency injection for
rails controllers.
So I have something like this
class LoginSessionsController < ApplicationController
def initialize(authenticator = TheRealAuthenticator)
@authenticator = authenticator
end
end
The plan was
OK, I'm probably being incredibly dense here
I have some steps defined something like this (extremely contrived) example
steps_for(:foo) do
#snip Given and When steps
Then("two nested divs and a image will be displayed") do
response.should have_tag("div") do
with_tag("div"
> Another attack.
>
> Then("two nested divs and an? $type will be displayed") do | type |
>
> response.should have_tag("div") do
>with_tag("div")
> end
> response.should have_tag(type == 'image' ? 'img' : type)
> end
>
Thanks for the cool idea Rick, but unfortunately
> You should be able to make your own module of helpers and include it into
> Spec::Story::World
>
> module Spec::Story::World
> def your_helper_method
> # i should have access to everything I need
> end
>end
brilliant, worked like a charm thanks :)
If you will indulge a ruby newb questi