On 2008-12-04, at 19:56, Pat Maddox wrote:
Nick Hoffman <[EMAIL PROTECTED]> writes:
On 2008-12-04, at 17:43, Nick Hoffman wrote:
The only solution that I can think of is to do this:
before :each do
  @account_url = account_url
end
it_should_redirect_to 'the account page', @account_url

Actually, that suggestion above of mine doesn't work. It fails with:
 You have a nil object when you didn't expect it!
 The error occurred while evaluating nil.rewrite
 (eval):17:in `account_url'

I thought of it while writing that last email, but didn't test it
before hitting send.
-Nick
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

It's the same as

class Foo
 @class_instance_variable = "blah"

 def foo
   puts @class_instance_variable
 end
end

Foo.foo will print nothing, because @class_instance_variable is nil in
the object instance.

Anyway, I thought of an even cleaner way to do things than using a
block, assuming you only care about calling one method:

do_something(:blah_url_helper)

def do_something(helper_name)
 send(helper_name)
end

Pat

Hi Pat. That's a great suggestion. Here's what I ended up doing:
http://gist.github.com/32424

Thanks,
Nick

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to