Mercurial > hg > soundsoftware-site
comparison vendor/plugins/embedded/test/functional/embedded_controller_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 EmbeddedControllerTest < ActionController::TestCase | |
21 fixtures :projects, :enabled_modules, :users, :roles, :members | |
22 | |
23 def setup | |
24 fixtures_path = File.dirname(__FILE__) + '/../fixtures/html' | |
25 | |
26 Setting.plugin_embedded = { 'path' => fixtures_path, | |
27 'index' => 'main.html overview-summary.html index.html', | |
28 'extensions' => 'html png gif', | |
29 'template' => '', | |
30 'encoding' => '', | |
31 'menu' => 'Embedded' } | |
32 | |
33 Project.find(1).enabled_modules << EnabledModule.new(:name => 'embedded') | |
34 | |
35 anonymous = Role.anonymous | |
36 anonymous.permissions += [:view_embedded_doc] | |
37 assert anonymous.save | |
38 end | |
39 | |
40 def test_get_root_should_redirect_to_index_file | |
41 get :index, :id => 'ecookbook' | |
42 assert_redirected_to :path => ['index.html'] | |
43 end | |
44 | |
45 def test_get_index_file | |
46 get :index, :id => 'ecookbook', :path => ['index.html'] | |
47 assert_response :success | |
48 assert_template 'index' | |
49 assert_tag :h3, :content => 'C0 code coverage information' | |
50 end | |
51 | |
52 def test_get_subdirectory_file | |
53 get :index, :id => 'ecookbook', :path => ['misc', 'misc.html'] | |
54 assert_response :success | |
55 assert_template 'index' | |
56 assert_tag :b, :content => 'Misc file' | |
57 end | |
58 | |
59 def test_get_invalid_extension_should_be_denied | |
60 get :index, :id => 'ecookbook', :path => ['misc', 'misc.txt'] | |
61 assert_response 500 | |
62 end | |
63 end |