RSPEC: Looking for some clarification

So, I am new to testing and am a fan of the RSPEC framework, so far.
There are still a few things about mocking/stubbing that I am unclear
on.

I am using the line...

Project.should_receive(:find).with(@params[:id]).and_return(@project)

...to test...

Project.find(params[:id])

... I am not sure what @params[:id] is referring to in my test. When
I pass it in with(anything()) the test passes but with(@params[:id])
it fails. I have created @params = {:id => "1"} and thought that
would be enough, but it is not. If anyone can shed some light as to
what exactly is going on here or at least point me in the right
direction, I would very much appreciate it.

I will post my test in it's entirety just in case it is a mistake
somewhere else.
I'm currently trying to test:

  def front
    @project = Project.find(params[:id])
  end

The following code is my test:

  describe Clients::ProjectsController, "testing the 'front' action" do

    before(:each) do
      @staff = mock_model(User)
      Project.stub!(:staff).and_return(@staff)

      @project = mock_model(Project, :id => "1")
      Project.stub!(:find).and_return(@project)
      @params = { :id => "1" }
    end

    def do_post
      post :front, :project => @params
    end

    it "should find all of the projects with the params" do
  
Project.should_receive(:find).with(@params[:id]).and_return(@project)
# <- this is my problem line
      do_post
    end

    it "should find all of the staff through the staff method" do
      Project.should_receive(:staff).with().and_return(@staff)
      do_post
    end

    it "should find the clients through the clients method"

  end

It looks like you are trying to test your model's functionality by
exercising the controller. If that's not the case, then you need to
tell your mock exactly what argument to expect. For example:

Project.should_receive(:find).with(:all).and_return([@project,
@project])

or for a single id,

Project.should_receive(:find).with("1").and_return([@project, @project])

If this kind of testing can be pushed into model testing, that's best.

Check out the rspec list:

http://rubyforge.org/mailman/listinfo/rspec-users

HTH