Project

General

Profile

Defect #36835 » fix-redmine-plugin-assets_directory.diff

Go MAEDA, 2022-03-24 07:16

View differences:

lib/redmine/plugin.rb (作業コピー)
104 104
        raise PluginNotFound, "Plugin not found. The directory for plugin #{p.id} should be #{p.directory}."
105 105
      end
106 106

  
107
      p.path = PluginLoader.directories{ |d| d.dir == p.directory }
107
      p.path = PluginLoader.directories.find {|d| d.to_s == p.directory}
108 108

  
109 109
      # Adds plugin locales if any
110 110
      # YAML translation files should be found under <plugin>/config/locales/
......
183 183

  
184 184
    # Returns the absolute path to the plugin assets directory
185 185
    def assets_directory
186
      path.assedts_dir
186
      path.assets_dir
187 187
    end
188 188

  
189 189
    def <=>(plugin)
test/unit/lib/redmine/plugin_test.rb (作業コピー)
27 27
    @klass.directory = Rails.root.join('test/fixtures/plugins')
28 28
    # In case some real plugins are installed
29 29
    @klass.clear
30

  
31
    # Change plugin loader's directory for testing
32
    Redmine::PluginLoader.directory = @klass.directory
33
    Redmine::PluginLoader.setup
30 34
  end
31 35

  
32 36
  def teardown
......
55 59
    assert_equal 'http://example.net/jsmith', plugin.author_url
56 60
    assert_equal 'This is a test plugin', plugin.description
57 61
    assert_equal '0.0.1', plugin.version
62
    assert_equal File.join(@klass.directory, 'foo_plugin', 'assets'), plugin.assets_directory
58 63
  end
59 64

  
60 65
  def test_register_should_raise_error_if_plugin_directory_does_not_exist
    (1-1/1)