[rspec-devel] huge setup methods? I think I'm on the wrong path

Jens-Christian Fischer jcfischer.lists at gmail.com
Wed Jan 24 14:52:41 EST 2007

I'm relatively new to RSpec and am still struggling with some basics:

Consider the following view spec:

context "Given a request to render rooms/show" do
   setup do
     @room = mock("room")
     @message = mock("message")
     @messages = [@message]
     @u1 = mock("user1")
     @u2 = mock("user2")

     users = [@u1, @u2]
     admins = [@u1]
     assigns[:room] = @room
     assigns[:messages] = @messages

   specify "should dispaly the userlist" do

     render 'rooms/show'
     #response.should_have "h1", :text => "Liftchat"
     #response.should_have "ul[id=users]"
     response.should_have "li>a", :text => "jcfischer"
     response.should_have "li>a", :text => "lau"


It seems to me, that I'm doing something completely stupid, because  
my setup method is growing and growing, stubbing every method call  
that my views are making. Is this supposed to look like this or am I  
missing something completely obvious?


More information about the rspec-devel mailing list