I''m using Rails 3.2.12, and I have a spec similar to this: # Spec before do post :create end it { session[:order_id].should be_nil } # Controller def create ... session[:order_id] = nil end Now, that spec passes/fails depending on the controller redirecting or rendering: Passes: redirect_to root_path Fails: render :create Is this an expected behavior? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Richard Schneeman
2013-Mar-16 21:05 UTC
Re: Controller test session issue when using render
If you can reproduce this problem in a new app open an issue on rails/rails. If you cannot, I suggest posting a question on Stack Overflow. -- Richard Schneeman http://heroku.com @schneems (http://twitter.com/schneems) On Friday, March 15, 2013 at 9:21 AM, Fabio Kreusch wrote:> I''m using Rails 3.2.12, and I have a spec similar to this: > > # Spec > before do > post :create > end > > it { session[:order_id].should be_nil } > > # Controller > def create > ... > > session[:order_id] = nil > end > > Now, that spec passes/fails depending on the controller redirecting or rendering: > > Passes: redirect_to root_path > Fails: render :create > > Is this an expected behavior? > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.