Fleeting Ideas RSS

Rob's passing thoughts caught for posterity

Upcoming

...

Rear view

Sep
12th
Wed
permalink

undefined method `parse_query_parameters’ for ActionController::AbstractRequest:Class

Seems RSpec on Rails 1.0.8 is calling Rails code that’s not in Rails 1.2.3, hence the error:

undefined method `parse_query_parameters' for ActionController::AbstractRequest:Class
/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/redirect_to.rb:54:in `query_hash'

Just to get things moving I’ve copied the parse_query_parameters method from trunk ActionController::AbstractRequest into /vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/redirect_to.rb

def parse_query_parameters(query_string)
  return {} if query_string.blank?

  pairs = query_string.split('&').collect do |chunk|
    next if chunk.empty?
    key, value = chunk.split('=', 2)
    next if key.empty?
    value = value.nil? ? nil : CGI.unescape(value)
    [ CGI.unescape(key), value ]
  end.compact

  UrlEncodedPairParser.new(pairs).result
end

That seemed to work, so back to autotest and the specs!