Sha256: 7f3083d294f7b97d8c3ed1cc15c73247ae7f692fb6dd3188b2a4e1851ab40376

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Hyperdrive::Middleware::Charset do

  def app
    inner_app = ->(env) { [200, {}, [env['hyperdrive.params']]] }
    Hyperdrive::Middleware::Charset.new(inner_app)
  end

  before do
    @env = default_rack_env(default_resource).merge('hyperdrive.params' => {})
    @env.merge!('REQUEST_METHOD' => 'POST')
    @params = { id: '1001', name: 'John Connor'.encode('ASCII-8BIT') }
  end

  it "will enforce accept-charset encoding on param values" do
    post '/', @params, @env.merge('hyperdrive.params' => @params)
    last_response.body.must_equal "{:id=>\"1001\", :name=>\"John Connor\"}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hyperdrive-0.0.22 spec/hyperdrive/middleware/charset_spec.rb