<commit_before><commit_msg>Test #run properly using the infamous redirect example.<commit_after>require File.expand_path("helper", File.dirname(__FILE__))

test "redirect canonical example" do
  Cuba.define do
    def redirect(*args)
      run Cuba::Ron.new { on(true) { res.redirect(*args) }}
    end

    on path("account") do
      redirect "/login", 307

      res.write "Super secure content"
    end
  end

  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/account" }

   _, _, resp = Cuba.call(env)

  assert_equal "/login", resp["Location"]
  assert_equal 307, resp.status
  assert_equal [], resp.body
end
{'fraction_non_alphanumeric': 0.1388888888888889, 'fraction_numerical': 0.00980392156862745, 'mean_word_length': 3.6090225563909772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3455221', 'n_tokens_mistral': 200, 'n_tokens_neox': 186, 'n_words': 51}