Sha256: 5932a8ba8d4d3382c62ddb5587b43dd9b8d81018967c326e86e3f09bd496ddb1

Contents?: true

Size: 829 Bytes

Versions: 21

Compression:

Stored size: 829 Bytes

Contents

require 'test/unit'
require 'cgi'
require 'stringio'
require File.dirname(__FILE__) + '/../../lib/action_controller/cgi_ext/raw_post_data_fix'

class RawPostDataTest < Test::Unit::TestCase
  def setup
    ENV['REQUEST_METHOD'] = 'POST'
    ENV['CONTENT_TYPE'] = ''
    ENV['CONTENT_LENGTH'] = '0'
  end

  def test_raw_post_data
    process_raw "action=create_customer&full_name=David%20Heinemeier%20Hansson&customerId=1"
  end

  private
    def process_raw(query_string)
      old_stdin = $stdin
      begin
        $stdin = StringIO.new(query_string.dup)
        ENV['CONTENT_LENGTH'] = $stdin.size.to_s
        CGI.new
        assert_not_nil ENV['RAW_POST_DATA']
        assert ENV['RAW_POST_DATA'].frozen?
        assert_equal query_string, ENV['RAW_POST_DATA']
      ensure
        $stdin = old_stdin
      end
    end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
devise_sociable-0.1.0 vendor/bundle/gems/actionpack-1.4.0/test/controller/raw_post_test.rb
actionpack-1.12.1 test/controller/raw_post_test.rb
actionpack-1.12.0 test/controller/raw_post_test.rb
actionpack-1.11.2 test/controller/raw_post_test.rb
actionpack-1.10.2 test/controller/raw_post_test.rb
actionpack-1.10.1 test/controller/raw_post_test.rb
actionpack-1.11.0 test/controller/raw_post_test.rb
actionpack-1.11.1 test/controller/raw_post_test.rb
actionpack-1.12.3 test/controller/raw_post_test.rb
actionpack-1.12.5 test/controller/raw_post_test.rb
actionpack-1.12.4 test/controller/raw_post_test.rb
actionpack-1.12.2 test/controller/raw_post_test.rb
actionpack-1.4.0 test/controller/raw_post_test.rb
actionpack-1.5.0 test/controller/raw_post_test.rb
actionpack-1.9.0 test/controller/raw_post_test.rb
actionpack-1.5.1 test/controller/raw_post_test.rb
actionpack-1.9.1 test/controller/raw_post_test.rb
actionpack-1.6.0 test/controller/raw_post_test.rb
actionpack-1.8.1 test/controller/raw_post_test.rb
actionpack-1.7.0 test/controller/raw_post_test.rb