[rspec-users] RSPEC how to post to a controller? What's wrong with this?

Joe Van Dyk joevandyk at gmail.com
Wed Mar 23 11:00:25 EDT 2011

Before_filters preventing it?

On Mar 22, 2011, at 11:06 PM, Mobyye <bhellman1 at gmail.com> wrote:

I'm trying to post to my controller in RSPEC by doing:

  it "should store create an IncomingMail record" do

    lambda {
      post :create,
           :from => 'xx',
           :to => 'xx',
           :cc => 'xx',
           :subject => 'xx',
           :message_text => 'xx',
           :message_html => 'xx'
    }.should change(IncomingMail, :count).by(1)


I do have this in my rake routes: POST /incoming_mails(.:format)
{:controller=>"incoming_mails", :action=>"create"}

I checked the logs. While the test above is hitting the controller, it is
never going inside the method def create. Any ideas why?


rspec-users mailing list
rspec-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110323/2d48610b/attachment.html>

More information about the rspec-users mailing list