Sha256: aed09bf19f5aa306c61e5307e5f509781e70b637ea2e267b0c45096bced55188

Contents?: true

Size: 576 Bytes

Versions: 2

Compression:

Stored size: 576 Bytes

Contents

require_relative "test_helper"

class TestScrubParams < Minitest::Test

  def test_scrub
    params =
      ActionController::Parameters.new({
        "name" => "Hello <script>alert('World')</script>",
        "tags" => ["<b>awesome</b>", "<a href='javascript:void();'>hack</a>"],
        "car" => {
          "make" => "<blink>Tesla</blink>"
        }
      })
    params.scrub!
    expected = {
      "name" => "Hello alert('World')",
      "tags" => ["awesome", "hack"],
      "car" => {
        "make" => "Tesla"
      }
    }
    assert_equal expected, params
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scrub_params-0.0.2 test/scrub_params_test.rb
scrub_params-0.0.1 test/scrub_params_test.rb