Problem with rspec test, undefined method 'post'

I am writing a spec to test the behavior of the mashup_controller when
someone sends a query through a URL. I need to simulate the parameters
contained in the URL, and i read that the post() method will do that,
however when i get an error:

  1. MashupController simulates query
    Failure/Error: post :create
    undefined method `post’ for

    ./mashup_controller_rspec.rb:9:in `block (2 levels) in <top


Finished in 0.20199 seconds 1 example, 1 failure

Failed examples:

rspec ./mashup_controller_rspec.rb:7 # MashupController simulates query

Here is my code:

require ‘spec_helper’
require ‘mashup_controller.rb’

describe MashupController do
it “simulates query” do
post :create

Sorry if I’m not making any sense. I am very new to rails and rspec. Any
help would be appreciated. Thanks.

On Sun, Aug 21, 2011 at 1:34 PM, Michael Hickman
[email protected]wrote:

# ./mashup_controller_rspec.rb:9:in `block (2 levels) in <top

Here is my code:

Welcome to RSpec!

You need to put your controller specs in a “spec/controllers” directory.
RSpec will look for spec files in spec/controllers and include the
files in each spec file. Also, you do not need to “require
‘mashup_controller.rb’” - Rails already loads it for you.

Let us know if that works.