-----Controller -------------- def update @user = User.find_by_id( user.id ) if request.post? unless params[ :user ].nil? if @user.update_attributes( params[ :user ] ) redirect_to :action => :show end else render :status => 400, :text => 'No user parameters end
------- spec ------------- describe UserProfilesController do before(:each) do @user = mock_model(User) controller.stub!(:requires_user).and_return @user controller.stub!(:user).and_return @user User.stub!(:find_by_id).and_return(@user) @user.stub!(:update_attributes).and_return(true) end it "should find User and return object" do User.should_receive(:find_by_id).with("1").and_return(@user) @user.should_receive(:update_attributes).and_return(true) post :update, :id =>"1", :user => {} end end ------- Error -------------------------------- <User(id: integer, created_on: datetime, updated_on: datetime, destroyed_on: dat etime, accessed_on: datetime, email_address: string, name_first: string, name_la st: string, mailing_address_id: integer, billing_address_id: integer, name_displ ay: string, picture_id: integer, url: string, country: string, freelance: boolea n, statement: string, hostname_active: boolean, hostname: string, promotional_ma ilings: boolean, sales_commission_rate: float, referral_commission_rate: float, employee_lock: boolean) (class)> expected :find_by_id with ("1") but received it with ([1001]) How shall I pass the id to the spec. Please help overcome this issue -- View this message in context: http://www.nabble.com/Passing-user-id-to-spec-%7C-error-tp23553916p23553916.html Sent from the rspec-users mailing list archive at Nabble.com. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users