<commit_before>require 'minitest_helper'

class ControllerTest < MiniTest::Test

  class FakeController < Rims::Controller
    description "Fake Controller"

    route :post, "/fake"

    action do
      "done..."
    end
  end

  class FourOhFourController < Rims::Controller
    description "404s"
    route :get, "/nonexistent"
    action do
      render "Oh no!", status: 404
    end
  end

  def test_controller_has_description
    assert_equal "Fake Controller", FakeController.description
  end

  def test_route_adds_an_endpoint
    endpoint = FakeController.endpoints.first
    assert_equal "POST", endpoint.verb
    assert_equal "/fake", endpoint.path
  end

  def test_controllers_are_registered
    assert_includes Rims::Controller.registry, FakeController
  end

  def test_controllers_can_render_statuses
    f = FourOhFourController.new(MiniTest::Mock.new)
    result = f.call
    assert_equal 404, result[0]
    assert_equal ["Oh no!"], result[2]
  end
end<commit_msg>Rename FakeController=>TestController<commit_after>require 'minitest_helper'

class ControllerTest < MiniTest::Test

  class TestController < Rims::Controller
    description "Test Controller"

    route :post, "/test"

    action do
      "done..."
    end
  end

  class FourOhFourController < Rims::Controller
    description "404s"
    route :get, "/nonexistent"
    action do
      render "Oh no!", status: 404
    end
  end

  def test_controller_has_description
    assert_equal "Test Controller", TestController.description
  end

  def test_route_adds_an_endpoint
    endpoint = TestController.endpoints.first
    assert_equal "POST", endpoint.verb
    assert_equal "/test", endpoint.path
  end

  def test_controllers_are_registered
    assert_includes Rims::Controller.registry, TestController
  end

  def test_controllers_can_render_statuses
    f = FourOhFourController.new(MiniTest::Mock.new)
    result = f.call
    assert_equal 404, result[0]
    assert_equal ["Oh no!"], result[2]
  end
end
{'fraction_non_alphanumeric': 0.07931726907630522, 'fraction_numerical': 0.01104417670682731, 'mean_word_length': 3.7679425837320575, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 4, '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': '203592', 'n_tokens_mistral': 632, 'n_tokens_neox': 593, 'n_words': 150}