Mobyye
2011-Mar-19 21:32 UTC
[rspec-users] RSPEC how to post to a controller? What''s wrong with this?
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) end 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? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110319/8978c5ab/attachment.html>
Justin Ko
2011-Mar-23 06:23 UTC
[rspec-users] RSPEC how to post to a controller? What''s wrong with this?
On Sat, Mar 19, 2011 at 2:32 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) > > end > > > 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? > > Thanks > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >So you checked the log and you see a sql insert statement? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110322/6fa56ca7/attachment.html>
Pat Maddox
2011-Mar-23 10:29 UTC
[rspec-users] RSPEC how to post to a controller? What''s wrong with this?
On Mar 19, 2011, at 2:32 PM, Mobyye 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) > > end > > > 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? > > ThanksOff the top of my head I can think of 198723 possibilities. To help expedite the narrowing down process, please provide: 1. Complete example code 2. Complete controller code 3. Complete rspec output 4. Complete log output Pat -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110323/7bbe631c/attachment.html>
Joe Van Dyk
2011-Mar-23 15:00 UTC
[rspec-users] RSPEC how to post to a controller? What''s wrong with this?
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) end 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? Thanks _______________________________________________ rspec-users mailing list rspec-users at rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110323/2d48610b/attachment.html>