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

I am using the line...

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


... 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])

The following code is my test:

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

    before(:each) do
      @staff = mock_model(User)

      @project = mock_model(Project, :id => "1")
      @params = { :id => "1" }

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

    it "should find all of the projects with the params" do
# <- this is my problem line

    it "should find all of the staff through the staff method" do

    it "should find the clients through the clients method"


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:


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: