<commit_before>require "test_helper"

module Godmin
  class ResolverTest < ActiveSupport::TestCase
    module Admin
      class Engine < Rails::Engine
        isolate_namespace Admin
      end

      class Controller < ActionController::Base; end
    end

    class Controller < ActionController::Base; end

    def test_default_resource_resolver
      resolver = ResourceResolver.new("articles", EngineWrapper.new(Controller))

      assert_equal [
        File.join(Rails.application.root, "app/views/resource"),
        File.join(Godmin::Engine.root, "app/views/godmin/resource")
      ], resolver.template_paths("articles")
    end

    def test_default_godmin_resolver
      resolver = GodminResolver.new("articles", EngineWrapper.new(Controller))

      assert_equal [
        File.join(Godmin::Engine.root, "app/views/godmin/shared")
      ], resolver.template_paths("shared")
    end

    def test_engine_resource_resolver
      resolver = ResourceResolver.new("godmin/resolver_test/admin/articles", EngineWrapper.new(Admin::Controller))

      assert_equal [
        File.join(Admin::Engine.root, "app/views/godmin/resolver_test/admin/resource"),
        File.join(Godmin::Engine.root, "app/views/godmin/resource")
      ], resolver.template_paths("godmin/resolver_test/admin/articles")
    end

    def test_engine_godmin_resolver
      resolver = GodminResolver.new("godmin/resolver_test/admin/articles", EngineWrapper.new(Admin::Controller))

      assert_equal [
        File.join(Godmin::Engine.root, "app/views/godmin/shared")
      ], resolver.template_paths("godmin/resolver_test/admin/shared")
    end
  end
end<commit_msg>Renames tests<commit_after>require "test_helper"

module Godmin
  class ResolverTest < ActiveSupport::TestCase
    module Admin
      class Engine < Rails::Engine
        isolate_namespace Admin
      end

      class Controller < ActionController::Base; end
    end

    class Controller < ActionController::Base; end

    def test_resource_resolver_when_not_namespaced
      resolver = ResourceResolver.new("articles", EngineWrapper.new(Controller))

      assert_equal [
        File.join(Rails.application.root, "app/views/resource"),
        File.join(Godmin::Engine.root, "app/views/godmin/resource")
      ], resolver.template_paths("articles")
    end

    def test_godmin_resolver_when_not_namespaced
      resolver = GodminResolver.new("articles", EngineWrapper.new(Controller))

      assert_equal [
        File.join(Godmin::Engine.root, "app/views/godmin/shared")
      ], resolver.template_paths("shared")
    end

    def test_resource_resolver_when_namespaced
      resolver = ResourceResolver.new("godmin/resolver_test/admin/articles", EngineWrapper.new(Admin::Controller))

      assert_equal [
        File.join(Admin::Engine.root, "app/views/godmin/resolver_test/admin/resource"),
        File.join(Godmin::Engine.root, "app/views/godmin/resource")
      ], resolver.template_paths("godmin/resolver_test/admin/articles")
    end

    def test_godmin_resolver_when_namespaced
      resolver = GodminResolver.new("godmin/resolver_test/admin/articles", EngineWrapper.new(Admin::Controller))

      assert_equal [
        File.join(Godmin::Engine.root, "app/views/godmin/shared")
      ], resolver.template_paths("godmin/resolver_test/admin/shared")
    end
  end
end
{'fraction_non_alphanumeric': 0.10890493381468111, 'fraction_numerical': 0.0, 'mean_word_length': 3.7910662824207493, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '4717691', 'n_tokens_mistral': 1008, 'n_tokens_neox': 968, 'n_words': 140}