Is it redirecting or is it rendering new?
On 8/8/07, Fischer, Daniel <[EMAIL PROTECTED]> wrote: > It's redirecting to /users/1 so it's not causing a fail on the exception, > which I don't know why. My question is how to properly do this in rSpec? > > > On 8/8/07, Lance Carlson <[EMAIL PROTECTED]> wrote: > > Does it redirect instead? > > > > On 8/8/07, Fischer, Daniel <[EMAIL PROTECTED]> wrote: > > > 1 def create > > > 2 @user = User.new(params[:user]) > > > 3 @ user.save! > > > 4 self.current_user = @user > > > 5 redirect_to user_path(@user) > > > 6 flash[:notice] = "Thanks for signing up!" > > > 7 rescue ActiveRecord::RecordInvalid > > > 8 render :action => 'new' > > > 9 end > > > > > > I can't seem to properly spec this out. I am trying numerous things, the > > > latest one is this, which makes sense but it still fails... > > > > > > > > > it "should re-render new on an invalid record exception" do > > > post :create, :user => {:login => nil} > > > response.should render_template(:new) > > > end > > > > > > should re-render new on an invalid record exception > > > expected "new", got nil > > > > > > Any help would be great, thanks! > > > > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users@rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users@rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users