#14 √ invalid
Zach Holman

setup in contexts not discovering methods

Reported by Zach Holman | February 4th, 2008 @ 11:22 PM

I'm on edge Rails and Shoulda 4.0.0.

I have an app that's using restful_authentication and Shoulda (which would seem to me to be a fairly popular combination). I've run into some really weird issues with my tests- specifically, I can't use login_as anymore in my tests. I've narrowed it down to setup blocks in contexts:

context "An admin" do

setup do

login_as :admin

end

#### testing code for this context

end

My specific error:

"NoMethodError: undefined method `login_as' for UsersControllerTest:Class"

If I pop "login_as :admin" into a proper block ("def should_do_something; login_as :admin; end;") it doesn't toss up the error. I didn't have this issue with earlier versions of Shoulda- any ideas?

Comments and changes to this ticket

  • Tammer Saleh

    Tammer Saleh February 5th, 2008 @ 10:12 AM

      • → State changed from “new” to “invalid”

    Hi Zach,

    This is an issue that was recently introduced with rails edge. There's a ticket for it now, but the jist is that rails now has a setup class method that takes a block (like shoulda does).

    We're discussing what to do about this via that ticket.

  • Zach Holman

    Zach Holman February 5th, 2008 @ 10:49 AM

    Sorry about that, Tammer- I took a look before posting but must have missed that ticket. I'm watching that one instead; thanks!

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket