themes_controller_test.rb
1.29 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
38
39
40
41
42
43
require File.dirname(__FILE__) + '/../test_helper'
class ThemesControllerTest < ActionController::TestCase
should 'display list of themes for selection' do
profile = create_user('testinguser').person
Theme.expects(:system_themes).returns([Theme.new('first'), Theme.new('second')])
get :index, :profile => 'testinguser'
%w[ first second ].each do |item|
assert_tag :tag => 'a', :attributes => { :href => "/myprofile/testinguser/themes/set/#{item}" }, :descendant => { :tag => 'img' }
end
end
should 'save selection of theme' do
profile = create_user('testinguser').person
get :set, :profile => 'testinguser', :id => 'onetheme'
profile.reload
assert_equal 'onetheme', profile.theme
end
should 'point back to control panel' do
create_user('testinguser').person
get :index, :profile => 'testinguser'
assert_tag :tag => 'a', :attributes => { :href => '/myprofile/testinguser' }, :content => 'Back'
end
should 'check access control when choosing theme'
should 'check access control when editing themes'
should 'only allow environment-approved themes to be selected'
should 'list user-created themes with link for editing'
should 'offer to create new theme'
should 'be able to save new theme'
should 'be able to save existing theme'
end