Hi All, I have a test that is failing and I can''t figure it out... it fails the first time in autotest and the second time it runs (once autotest is started), the test doesn''t fail. Thanks in advance for your help. Here is the test file: #################TEST FILE############ require File.dirname(__FILE__) + ''/../../test_helper'' class Admin::StoriesControllerTest < ActionController::TestCase def first_story_form_attributes s = stories(:one).attributes s.delete("updated_at") s.delete("created_at") s.delete("id") s end def test_should_not_update_story_admin old_attributes = first_story_form_attributes old_attributes[:headline] = "" post :update, {:id => stories(:one).id, :record => old_attributes} assert_response :success #THIS IS LINE 46 assert_select "div#errorExplanation" do assert_select "li", :text => /Headline/ end end end ###END TEST FILE##### ####ERROR REPORTED:##### Here is the error: 1) Failure: test_should_not_update_story_admin(Admin::StoriesControllerTest) [./test/functional/admin/stories_controller_test.rb:46:in `test_should_not_update_story_admin'' /Users/danderson/Projects/my_project/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/testing/default.rb:7:in `run'']: Expected response to be a <:success>, but was <302> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dustin Anderson wrote:> Expected response to be a <:success>, but was <302>Can you show us your controller code handling the action as it appears that you are redirecting the response ilan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ilan Berci wrote:> Dustin Anderson wrote: > >> Expected response to be a <:success>, but was <302> > > Can you show us your controller code handling the action as it appears > that you are redirecting the response > > ilanThanks Ilan, Unfortunately, my controller is an Active Scaffold controller (www.activescaffold.com). So, there isn''t much to it: class Admin::StoriesController < ApplicationController layout ''admin'' active_scaffold :story do |config| config.create.link.page = true config.update.link.page = true config.create.multipart = true config.update.multipart = true config.list.columns = [ :date, :headline, :author, :state, :country, :is_published ] end end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dustin Anderson wrote:> Ilan Berci wrote: >> Dustin Anderson wrote: >> >>> Expected response to be a <:success>, but was <302> >> >> Can you show us your controller code handling the action as it appears >> that you are redirecting the response >> >> ilan > > Thanks Ilan, > > Unfortunately, my controller is an Active Scaffold controller > (www.activescaffold.com). So, there isn''t much to it: > > class Admin::StoriesController < ApplicationController > layout ''admin'' > active_scaffold :story do |config| > config.create.link.page = true > config.update.link.page = true > config.create.multipart = true > config.update.multipart = true > config.list.columns = [ :date, :headline, :author, :state, :country, > :is_published ] > end > > endSorry, not much experience with scaffolding as I believe that it is next to useless and only hampers you from getting your hands dirty and figuring out the details of how rails handles MVC. ilan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---