Re: [rspec-users] Simple Association Redirect on delete

2011-05-02 Thread Canuk
Here is how I ended up getting my test to pass: instead of using a stub/mock, I used a Factory, since that more closely aligned with the actual functionality anyway. On Feb 28, 7:14 pm, Charley wrote: > I am not sure if I am properly using the respond to call as you > suggested. Here is what I tr

Re: [rspec-users] Simple Association Redirect on delete

2011-05-02 Thread Canuk
I'm having the (seemingly) exact same issue. Were you able to figure this out? I'm relatively new to rspec and my controller code works, but the test is failing. It seems like it is not able to retrieve a method from the stub. On Feb 28, 7:14 pm, Charley wrote: > I am not sure if I am properly

Re: [rspec-users] Simple Association Redirect on delete

2011-02-28 Thread Charley
I am not sure if I am properly using the respond to call as you suggested. Here is what I tried: it "redirects to the bugs parent project" do Bug.stub(:find) { mock_bug } mock_bug.should respond_to :project_id delete :destroy, :id => "1" response.should redirect_to(project_path(:id => mock_

Re: [rspec-users] Simple Association Redirect on delete

2011-02-28 Thread Craig Demyanovich
On Sun, Feb 27, 2011 at 10:57 PM, Charley wrote: ... > it "redirects to the bugs list" do > Bug.stub(:find) { mock_bug } > delete :destroy, :id => "1" > response.should redirect_to(bugs_url) > end > > This fails for obvious reasons. A bug belongs to a project so the > redirect should go to the

[rspec-users] Simple Association Redirect on delete

2011-02-28 Thread Charley
So am fairly new to rspec and am trying to get the hang of it, but have run into a few issues I cant figure out. Several times in my code I have model that belongs to a parent, when the model is deleted, instead of redirecting to the index action, it redirects to the show action for its parent mode