I'm having trouble understanding what the assigns() method does, as
described at the following link:

http://ruby.railstutorial.org/chapters/modeling-and-viewing-users-two#sec:better_user_views

The User model has been 'rake db:test:prepare'ed, but I checked and no
records were
copied to the test db after doing that.  Yet the description of
assigns() says that the
code:

  describe "GET 'show'" do

    before(:each) do
      @user = Factory(:user)
    end

   .
   .
   .


    it "should find the right user" do
      get :show, :id => @user
      assigns(:user).should == @user
    end
  end
  .
  .
  .
end

'then verifies that the variable retrieved from the database in the
action [where the action looks like this:


class UsersController < ApplicationController

  def show
    @user = User.find(params[:id])
  end


corresponds to the @user instance created by Factory Girl.   I don't
know where the 'variable retrieved from the database' comes from??

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to