Re: [rspec-users] testing a post to a controller's create action

2011-11-20 Thread David Chelimsky
On Nov 20, 2011, at 2:46 AM, Patrick J. Collins wrote: >> I haven't used ActiveRecord in quite awhile (been using MongoDB), but it >> looks like you cannot instantiate a record with attributes that don't exist. >> I think you have two options here: >> >> 1.) Only use valid attributes in your pa

Re: [rspec-users] testing a post to a controller's create action

2011-11-20 Thread Patrick J. Collins
> I haven't used ActiveRecord in quite awhile (been using MongoDB), but it > looks like you cannot instantiate a record with attributes that don't exist. > I think you have two options here: > > 1.) Only use valid attributes in your params. > 2.) Add `with` to your stub to exactly match the argu

Re: [rspec-users] testing a post to a controller's create action

2011-11-20 Thread Justin Ko
On Nov 19, 2011, at 11:14 PM, Patrick J. Collins wrote: >> Please post the backtrace. > > Failures: > > 1) PostsController#store_post_params stores the last post params in the > session > Failure/Error: post :create, { :submit_action => submit_type.to_s, :post > => { :foo => "bar" } } >

Re: [rspec-users] testing a post to a controller's create action

2011-11-19 Thread Patrick J. Collins
> Please post the backtrace. Failures: 1) PostsController#store_post_params stores the last post params in the session Failure/Error: post :create, { :submit_action => submit_type.to_s, :post => { :foo => "bar" } } ActiveRecord::UnknownAttributeError: unknown attribute: foo

Re: [rspec-users] testing a post to a controller's create action

2011-11-19 Thread Justin Ko
On Nov 19, 2011, at 4:03 PM, Patrick J. Collins wrote: >> #store_params is not an "action", therefore I would make it private. > > I agree completely, and probably should have specified that in my sample code > (it certainly is private in my real non-hypothetical implementation). > >> Since it

Re: [rspec-users] testing a post to a controller's create action

2011-11-19 Thread Patrick J. Collins
> #store_params is not an "action", therefore I would make it private. I agree completely, and probably should have specified that in my sample code (it certainly is private in my real non-hypothetical implementation). > Since it is used only by the #create action, I would spec it as part of the

Re: [rspec-users] testing a post to a controller's create action

2011-11-19 Thread Justin Ko
On Nov 19, 2011, at 9:57 AM, Patrick J. Collins wrote: >>> I never see the debugger prompt.. Can anyone PLEASE tell me why this is not >>> working? In any other test, binding.pry or debugger interrupts the test >>> flow >>> and gives me access to the current scope of the debugger call. >> >>

Re: [rspec-users] testing a post to a controller's create action

2011-11-19 Thread Patrick J. Collins
> > I never see the debugger prompt.. Can anyone PLEASE tell me why this is not > > working? In any other test, binding.pry or debugger interrupts the test > > flow > > and gives me access to the current scope of the debugger call. > > Got any authentication in front of posts#create? Yeah, tha

Re: [rspec-users] testing a post to a controller's create action

2011-11-18 Thread Mike Mazur
Hi, On Sat, Nov 19, 2011 at 09:42, Patrick J. Collins wrote: > I just spent a lot of time trying to get a test to pass that would not pass no > matter what I did, and I finally decided to just do something really simple to > verify that even that was working-- and it's not. > > class PostsControl

Re: [rspec-users] testing a post to a controller's create action

2011-11-18 Thread David Chelimsky
On Nov 18, 2011, at 7:42 PM, Patrick J. Collins wrote: > I just spent a lot of time trying to get a test to pass that would not pass no > matter what I did, and I finally decided to just do something really simple to > verify that even that was working-- and it's not. > > class PostsController <

[rspec-users] testing a post to a controller's create action

2011-11-18 Thread Patrick J. Collins
I just spent a lot of time trying to get a test to pass that would not pass no matter what I did, and I finally decided to just do something really simple to verify that even that was working-- and it's not. class PostsController < ApplicationController def create debugger