Hi,
Following is a test case in RailsTutorial. Generally I understand the syntax, But in this case, they define the @invalid_attr variable, but they dont seem to be using it. Infact in this line         @user.should_receive(:update_attributes).and_return(false), I think @user would have all the values from the factory, rather than @invalid_attr but it will return false. Is it not?
  describe "PUT 'update'" do
    before(:each) do
      @user = Factory(:user)
      test_sign_in(@user)
      User.should_receive(:find).with(@user).and_return(@user)
    end
describe 'failure' do
  before(:each) do
    @invalid_attr = { :email => "", :name => "" }
    @user.should_receive(:update_attributes).and_return(false)
  end
  it "should render the 'edit' page" do
    put :update, :id => @user, :user = {}
    response.should render_template 'edit'
  end
  it "should have the right title" do
    put :update, :id => @user, :user ={}
    response.should have_tag('title',/edit user/i)
  end
end
Thanks :)