Displaying 1 result from an estimated 1 matches for "star_path".
Did you mean:
tar_path
2006 Nov 22
3
Controller Isolation
...ject as well as raise RecordInvalid exception. Is this at all
possible?
I use the rescue statement in my controller methods and not @
object.new_record? or @object.valid? to check whether to redirect or render.
-- controller --
def create
@star = Star.create!(params[:star])
redirect_to star_path(@star)
rescue ActiveRecord::RecordInvalid
render :action => ''new''
end
-- spec --
@star = mock(''star'')
Star.should_receive(:create!).with({ ''name'' => nil }).and_return(@star)
I''m new to all the mocking/stubbing busine...