Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
lighthouse-import opened this Issue · 2 comments

1 participant

@lighthouse-import

Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6387
Created by Trent Ogren - 2011-02-08 04:38:59 UTC

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

@lighthouse-import

Imported from Lighthouse.
Comment by Derek Croft - 2011-02-08 15:38:39 UTC

+1 - We need the ability to be able to use frozen strings in our tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.