require 'test_helper'

class StatsTest < SystemTest
  test "page params is not integer" do
    visit '/stats?page="3\">XSS"'
    assert page.has_content? "Stats"
  end
end

require 'test_helper'

class StatsTest < SystemTest
  test "page params is not integer" do
    string_param_path = '/stats?page="3\""'
    visit URI.encode(string_param_path)
    assert page.has_content? "Stats"
  end
end

Fix URI::InvalidURIError: bad URI(is not URI?) in stats test
Fix URI::InvalidURIError: bad URI(is not URI?) in stats test

rake-test 0.7.0 stopped formatting params in urls[1] if they were already
in rest format. Test was passing in previous versions as side effect of
path being escaped by Rack::Test:Untils.build_nested_query (`#{escape(params)}`).
Test was originally written for paginate method blowing up in stats_controller
when params was not integer[2]. Test works the same after escaping the url.
XSS in path is removed because it misleads reader about purpose of test.

[1] https://github.com/rack-test/rack-test/commit/4a4b2c1bde9ce00929df2d5458915e342b9c1ea1#diff-f0893663b0bd05064de46c2b32ac81fbR213
[2] https://github.com/rubygems/rubygems.org/commit/e978744c4f86772f0478bcaf92df84aef40e3878
