edit_template_controller_test.rb
1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# FIXME: this tests must me moved into design plugin
require File.dirname(__FILE__) + '/../test_helper'
require 'edit_template_controller'
# Re-raise errors caught by the controller.
class EditTemplateController; def rescue_action(e) raise e end; end
class EditTemplateControllerTest < Test::Unit::TestCase
def setup
@controller = EditTemplateController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@rejected_dirs = ['.', '..', '.svn']
@theme_dir_path = "#{RAILS_ROOT}/public/themes"
@icons_dir_path = "#{RAILS_ROOT}/public/icons"
end
def test_select_theme_html
get :index
available_themes = Dir.new(@theme_dir_path).to_a - @rejected_dirs
available_themes.collect do |t|
assert_tag :tag => 'select', :attributes => {:id => 'theme_name', :name => 'theme_name'}, :child => {:tag =>"option", :attributes => {:value => t}}
end
end
def test_select_icons_theme_html
get :index
available_icons = Dir.new(@icons_dir_path).to_a - @rejected_dirs
available_icons.collect do |t|
assert_tag :tag => 'select', :attributes => {:id => 'icons_theme_name', :name => 'icons_theme_name'}, :child => {:tag =>"option", :attributes => {:value => t}}
end
end
end