This project is archived and is in readonly mode.

#6387 new
Trent Ogren

[patch] ActionController::TestCase#process barfs if it gets any frozen values as params

Reported by Trent Ogren | February 8th, 2011 @ 04:38 AM

If you do this on Ruby 1.9 (or any encoding aware Ruby) it will get pissed:

TPS_REPORT_TOPICS = { 'synergy' => "Synergy", 'rev_stream' => "Revenue Streams" }

class ActionController::TestCase
  //...
  test "can create a TPS report with a topic" do
    get :create, :tps_report => { :topic => TPS_REPORT_TOPICS.keys.first }
  end
end

Since rails tries to force encoding in place on all strings that are passed in, it will raise an error if it gets a frozen string.

I included a patch that dups all strings that are passed as parameters so that rails doesn't do in-place encoding on the strings that are passed in as parameters

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages