comparison vendor/plugins/embedded/test/unit/embedded_test.rb @ 154:317821dd92c9 feature_20

Add Embedded plugin, for Doxygen/Javadoc use
author Chris Cannam
date Thu, 27 Jan 2011 09:08:03 +0000
parents
children
comparison
equal deleted inserted replaced
149:e7c03e1738fb 154:317821dd92c9
1 # Redmine - project management software
2 # Copyright (C) 2008 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 require File.dirname(__FILE__) + '/../test_helper'
19
20 class EmbeddedTest < ActiveSupport::TestCase
21
22 def setup
23 Setting.plugin_embedded = { 'path' => '/path/to',
24 'index' => 'main.html overview-summary.html index.html',
25 'extensions' => 'html png gif',
26 'template' => 'doxygen',
27 'encoding' => '',
28 'menu' => 'Embedded' }
29 end
30
31 def test_available_templates
32 assert_equal ['doxygen', 'javadoc', 'rcov'], Redmine::Plugins::Embedded.available_templates
33 end
34
35 def test_assets
36 assert_equal ['rcov.css', 'rcov.js'], Redmine::Plugins::Embedded.assets('rcov')
37 end
38
39 def test_detect_template_from_path
40 to_test = { '/path/to/doc' => 'doxygen',
41 '/path/to/javadoc/html' => 'javadoc' }
42
43 to_test.each { |path, template| assert_equal template, Redmine::Plugins::Embedded.detect_template_from_path(path) }
44 end
45
46 def test_valid_extension
47 to_test = {'index.html' => true,
48 'path/to/index.html' => true,
49 'path/to/image.png' => true,
50 'path/to/something.else' => false}
51
52 to_test.each { |path, expected| assert_equal expected, Redmine::Plugins::Embedded.valid_extension?(path) }
53 end
54 end