While upgrading to Rails 1.1 one of my tests started failing which
wasn't failing before:

  def test_developer_action__not_allowed_if_other
    @developer_actions.each do |action|
      get action, { :id => 1 }, { :user => users(:existing) }, {}
      assert_redirected_to page_index_url, "action: #{action}"
      assert_match /privileges/, flash[:error], "action: #{action}"
    end
  end

@developer_actions is an array of action names to test. The test made it
through the first loop, but failed on the second. The reason it failed
was because the flash wasn't being set on the second loop. Instead the
flash was empty. Totally empty.

The problem goes away for me if I simply add a call to setup before the
call to get:

  def test_developer_action__not_allowed_if_other
    @developer_actions.each do |action|
  setup
      get action, { :id => 1 }, { :user => users(:existing) }, {}
      assert_redirected_to page_index_url, "action: #{action}"
      assert_match /privileges/, flash[:error], "action: #{action}"
    end
  end

Setup of course creates a new controller, request, etc... Has something
changed in the upgrade to 1.1 that would effect multiple process calls
in a controller test?

--
John Long
http://wiseheartdesign.com

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to