doc_controller_test.rb
1.07 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
44
require 'test_helper'
class DocControllerTest < ActionController::TestCase
should 'load toc in the root' do
get :index
assert_kind_of DocItem, assigns(:toc)
end
should 'display root document in the index' do
get :index
root = assigns(:index)
assert_kind_of DocSection, root
end
should 'translate the index' do
get :index
assert_equal 'en', assigns(:index).language
@controller.stubs(:language).returns('pt')
get :index
assert_equal 'pt', assigns(:index).language
end
should 'translate section' do
get :section, :section => 'admin'
assert_equal 'en', assigns(:section).language
@controller.stubs(:language).returns('pt')
get :section, :section => 'admin'
assert_equal 'pt', assigns(:section).language
end
should 'translate topic' do
get :topic, :section => 'admin', :topic => '100-email'
assert_equal 'en', assigns(:topic).language
@controller.stubs(:language).returns('pt')
get :topic, :section => 'admin', :topic => '100-email'
assert_equal 'pt', assigns(:topic).language
end
end