diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-11-16 20:00:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-11-16 20:00:20 +0000 |
commit | 9882217847a3c35fc8846a30ba58b34580934719 (patch) | |
tree | 1e5a54be7787bf0124773a89897c6db491ad22a2 /test | |
parent | 5362a85f2bd7cf6dd4e6ca42f5899f61bb875203 (diff) | |
download | redmine-9882217847a3c35fc8846a30ba58b34580934719.tar.gz redmine-9882217847a3c35fc8846a30ba58b34580934719.zip |
Adds Plugin#requires_redmine method so that plugin compatibility can be checked against current Redmine version (#2162).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2042 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/lib/redmine/plugin_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/plugin_test.rb b/test/unit/lib/redmine/plugin_test.rb index 48e868e52..e6237c216 100644 --- a/test/unit/lib/redmine/plugin_test.rb +++ b/test/unit/lib/redmine/plugin_test.rb @@ -52,4 +52,27 @@ class Redmine::PluginTest < Test::Unit::TestCase assert_equal 'This is a test plugin', plugin.description assert_equal '0.0.1', plugin.version end + + def test_requires_redmine + test = self + version = Redmine::VERSION.to_a.slice(0,3).join('.') + + @klass.register :foo do + test.assert requires_redmine(:version_or_higher => '0.1.0') + test.assert requires_redmine(:version_or_higher => version) + test.assert requires_redmine(version) + test.assert_raise Redmine::PluginRequirementError do + requires_redmine(:version_or_higher => '99.0.0') + end + + test.assert requires_redmine(:version => version) + test.assert requires_redmine(:version => [version, '99.0.0']) + test.assert_raise Redmine::PluginRequirementError do + requires_redmine(:version => '99.0.0') + end + test.assert_raise Redmine::PluginRequirementError do + requires_redmine(:version => ['98.0.0', '99.0.0']) + end + end + end end |