Sha256: 672b74e0eda1b0acbef61d93cd6d1d2b1743139354d9d06d40422f698a0b3e68

Contents?: true

Size: 1.42 KB

Versions: 12

Compression:

Stored size: 1.42 KB

Contents

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 setup
      @engine_wrapper_1 = EngineWrapper.new(Controller)
      @engine_wrapper_2 = EngineWrapper.new(Admin::Controller)
    end

    def test_engine_resolver_when_not_namespaced
      resolver = EngineResolver.new("articles", @engine_wrapper_1)

      assert_equal [
        "resource"
      ], resolver.template_paths("articles")
    end

    def test_engine_resolver_when_namespaced
      resolver = EngineResolver.new("godmin/resolver_test/admin/articles", @engine_wrapper_2)

      assert_equal [
        "godmin/resolver_test/admin/resource"
      ], resolver.template_paths("godmin/resolver_test/admin/articles")
    end

    def test_godmin_resolver_when_not_namespaced
      resolver = GodminResolver.new("articles", @engine_wrapper_1)

      assert_equal [
        "articles",
        "resource"
      ], resolver.template_paths("articles")
    end

    def test_godmin_resolver_when_namespaced
      resolver = GodminResolver.new("godmin/resolver_test/admin/articles", @engine_wrapper_2)

      assert_equal [
        "articles",
        "resource"
      ], resolver.template_paths("godmin/resolver_test/admin/articles")
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
godmin-2.3.0 test/unit/resolver_test.rb
godmin-2.2.2 test/unit/resolver_test.rb
godmin-2.2.1 test/unit/resolver_test.rb
godmin-2.2.0 test/unit/resolver_test.rb
godmin-2.1.0 test/unit/resolver_test.rb
godmin-2.0.0 test/unit/resolver_test.rb
godmin-1.5.0 test/lib/godmin/resolver_test.rb
godmin-1.4.0 test/lib/godmin/resolver_test.rb
godmin-1.3.1 test/lib/godmin/resolver_test.rb
godmin-1.3.0 test/lib/godmin/resolver_test.rb
godmin-1.2.0 test/lib/godmin/resolver_test.rb
godmin-1.1.0 test/lib/godmin/resolver_test.rb