[rspec-users] Can I construct the controller myself in a controller spec?

2009-03-04 Thread Perryn Fowler
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

[rspec-users] how do i remove duplication from my steps in story runner?

2008-04-22 Thread Perryn Fowler
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"

Re: [rspec-users] how do i remove duplication from my steps in story runner?

2008-04-22 Thread Perryn Fowler
> 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

Re: [rspec-users] how do i remove duplication from my steps in story runner?

2008-04-23 Thread Perryn Fowler
> 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