Makes Plugin#requires_redmine accept only major and minor version (#12299).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10826 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
19bd857790
commit
b3cf67cad4
|
@ -179,7 +179,7 @@ module Redmine #:nodoc:
|
|||
raise PluginRequirementError.new("#{id} plugin requires Redmine #{v} or higher but current is #{current.join('.')}")
|
||||
end
|
||||
when :version
|
||||
unless versions.include?(current.slice(0,3))
|
||||
unless versions.detect {|ver| current.slice(0, ver.size) == ver}
|
||||
raise PluginRequirementError.new("#{id} plugin requires one the following Redmine versions: #{v.join(', ')} but current is #{current.join('.')}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -88,24 +88,36 @@ class Redmine::PluginTest < ActiveSupport::TestCase
|
|||
Redmine::VERSION.stubs(:to_a).returns([2, 1, 3, "stable", 10817])
|
||||
|
||||
assert plugin.requires_redmine('2.1.3')
|
||||
assert plugin.requires_redmine('2.1')
|
||||
assert_raise Redmine::PluginRequirementError do
|
||||
plugin.requires_redmine('2.1.4')
|
||||
end
|
||||
assert_raise Redmine::PluginRequirementError do
|
||||
plugin.requires_redmine('2.2')
|
||||
end
|
||||
|
||||
assert plugin.requires_redmine(:version_or_higher => '0.1.0')
|
||||
assert plugin.requires_redmine(:version_or_higher => '2.1.3')
|
||||
assert plugin.requires_redmine(:version_or_higher => '2.1')
|
||||
assert_raise Redmine::PluginRequirementError do
|
||||
plugin.requires_redmine(:version_or_higher => '2.2.0')
|
||||
end
|
||||
assert_raise Redmine::PluginRequirementError do
|
||||
plugin.requires_redmine(:version_or_higher => '2.2')
|
||||
end
|
||||
|
||||
assert plugin.requires_redmine(:version => '2.1.3')
|
||||
assert plugin.requires_redmine(:version => ['2.1.3', '2.2.0'])
|
||||
assert plugin.requires_redmine(:version => '2.1')
|
||||
assert_raise Redmine::PluginRequirementError do
|
||||
plugin.requires_redmine(:version => '2.2.0')
|
||||
end
|
||||
assert_raise Redmine::PluginRequirementError do
|
||||
plugin.requires_redmine(:version => ['2.1.4', '2.2.0'])
|
||||
end
|
||||
assert_raise Redmine::PluginRequirementError do
|
||||
plugin.requires_redmine(:version => '2.2')
|
||||
end
|
||||
end
|
||||
|
||||
def test_requires_redmine_plugin
|
||||
|
|
Loading…
Reference in New Issue