Commit ac010fc840225a590450d0820353f369bc0f3a31
1 parent
34f936c8
Exists in
master
and in
29 other branches
Making tests pass
Showing
4 changed files
with
20 additions
and
17 deletions
Show diff stats
app/helpers/application_helper.rb
test/functional/doc_controller_test.rb
... | ... | @@ -23,20 +23,20 @@ class DocControllerTest < ActionController::TestCase |
23 | 23 | end |
24 | 24 | |
25 | 25 | should 'translate section' do |
26 | - get :section, :section => 'admin' | |
26 | + get :section, :section => 'user' | |
27 | 27 | assert_equal 'en', assigns(:section).language |
28 | 28 | |
29 | 29 | @controller.stubs(:language).returns('pt') |
30 | - get :section, :section => 'admin' | |
30 | + get :section, :section => 'user' | |
31 | 31 | assert_equal 'pt', assigns(:section).language |
32 | 32 | end |
33 | 33 | |
34 | 34 | should 'translate topic' do |
35 | - get :topic, :section => 'admin', :topic => '100-email' | |
35 | + get :topic, :section => 'user', :topic => 'accepting-friends' | |
36 | 36 | assert_equal 'en', assigns(:topic).language |
37 | 37 | |
38 | 38 | @controller.stubs(:language).returns('pt') |
39 | - get :topic, :section => 'admin', :topic => '100-email' | |
39 | + get :topic, :section => 'user', :topic => 'accepting-friends' | |
40 | 40 | assert_equal 'pt', assigns(:topic).language |
41 | 41 | end |
42 | 42 | ... | ... |
test/unit/application_helper_test.rb
... | ... | @@ -170,8 +170,10 @@ class ApplicationHelperTest < Test::Unit::TestCase |
170 | 170 | should 'ignore unexisting theme footer' do |
171 | 171 | stubs(:theme_path).returns('/user_themes/mytheme') |
172 | 172 | footer_path = RAILS_ROOT + '/public/user_themes/mytheme/footer.rhtml' |
173 | + alternate_footer_path = RAILS_ROOT + '/public/user_themes/mytheme/footer.html.erb' | |
173 | 174 | |
174 | 175 | File.expects(:exists?).with(footer_path).returns(false) |
176 | + File.expects(:exists?).with(alternate_footer_path).returns(false) | |
175 | 177 | expects(:render).with(:file => footer).never |
176 | 178 | |
177 | 179 | assert_nil theme_footer | ... | ... |
test/unit/doc_section_test.rb
... | ... | @@ -21,7 +21,7 @@ class DocSectionTest < ActiveSupport::TestCase |
21 | 21 | should 'list available sections' do |
22 | 22 | sections = DocSection.all |
23 | 23 | assert(sections.size > 0, 'should load sections ') |
24 | - assert(sections.find { |item| item.title == 'Administration'}, 'should find section "Administration"') | |
24 | + assert(sections.find { |item| item.title == 'Content Management'}, 'should find section "Content Management"') | |
25 | 25 | assert(sections.find { |item| item.title == 'User features'}, 'should find section "User features"') |
26 | 26 | end |
27 | 27 | |
... | ... | @@ -30,7 +30,7 @@ class DocSectionTest < ActiveSupport::TestCase |
30 | 30 | # break. If those translations change, this test will also break. |
31 | 31 | should 'list section for a given language' do |
32 | 32 | sections = DocSection.all('pt') |
33 | - assert(sections.find { |item| item.title == 'Administração'}, 'should find section "Administration" translated') | |
33 | + assert(sections.find { |item| item.title == 'Gerenciamento de conteúdo'}, 'should find section "Content Management" translated') | |
34 | 34 | assert(sections.find { |item| item.title == 'Funcionalidades de Usuário'}, 'should find section "User features" translated') |
35 | 35 | end |
36 | 36 | |
... | ... | @@ -46,28 +46,28 @@ class DocSectionTest < ActiveSupport::TestCase |
46 | 46 | # This test also depends on the existance of specific documentation sections. |
47 | 47 | # The same conditions as the above tests apply. |
48 | 48 | should 'list items' do |
49 | - section = DocSection.all.find {|item| item.title == 'Administration' } | |
49 | + section = DocSection.all.find {|item| item.title == 'Content Management' } | |
50 | 50 | assert section.items.size > 0, "should load at least one item" |
51 | - assert section.items.find {|item| item.title == 'E-mail settings' && item.text =~ /<h1>E-mail settings/ }, 'should find "E-mail settings" topic' | |
52 | - assert section.items.find {|item| item.title == 'Managing user roles' && item.text =~ /<h1>Managing/ }, 'should find "Managing user roles" topic' | |
51 | + assert section.items.find {|item| item.title == 'Adding pictures to gallery' && item.text =~ /<h1>Adding pictures to gallery/ }, 'should find "Adding pictures to gallery" topic' | |
52 | + assert section.items.find {|item| item.title == 'Creating a blog' && item.text =~ /<h1>Creating a blog/ }, 'should find "Creating a blog" topic' | |
53 | 53 | end |
54 | 54 | |
55 | 55 | # This test assumes ... (yada, yada, yada, the same as above) |
56 | 56 | should 'load translated items' do |
57 | - section = DocSection.all('pt').find {|item| item.title == 'Administração' } | |
57 | + section = DocSection.all('pt').find {|item| item.title == 'Gerenciamento de conteúdo' } | |
58 | 58 | assert section.items.size > 0, "should load at least one item" |
59 | - assert section.items.find {|item| item.title == 'Configurações de e-mail' && item.text =~ /<h1>Configurações/ }, 'should find translated "E-mail settings" topic' | |
60 | - assert section.items.find {|item| item.title == 'Gerenciando papéis de usuários' && item.text =~ /<h1>Gerenciando/ }, 'should find translated "Managing user roles" topic' | |
59 | + assert section.items.find {|item| item.title == 'Adicionando fotos na galeria' && item.text =~ /<h1>Adicionando fotos na galeria/ }, 'should find translated "Adding pictures to gallery" topic' | |
60 | + assert section.items.find {|item| item.title == 'Criando um blog' && item.text =~ /<h1>Criando um blog/ }, 'should find translated "Creating a blog" topic' | |
61 | 61 | end |
62 | 62 | |
63 | 63 | # This test assumes that Klingon (tlh) is not supported. If Noosfero does get |
64 | 64 | # aa Klingon translation, then this test will fail |
65 | 65 | should 'fallback to load original items when translation is not available' do |
66 | - section = DocSection.find('admin', 'tlh') | |
67 | - assert_equal 'Administration', section.title | |
66 | + section = DocSection.find('user', 'tlh') | |
67 | + assert_equal 'User features', section.title | |
68 | 68 | |
69 | - topic = section.find('100-email') | |
70 | - assert_equal 'E-mail settings', topic.title | |
69 | + topic = section.find('accepting-friends') | |
70 | + assert_equal 'Accepting friends', topic.title | |
71 | 71 | end |
72 | 72 | |
73 | 73 | should 'find in items' do |
... | ... | @@ -80,8 +80,8 @@ class DocSectionTest < ActiveSupport::TestCase |
80 | 80 | end |
81 | 81 | |
82 | 82 | should 'be able to find section by its id' do |
83 | - assert_equal "Administration", DocSection.find('admin').title | |
84 | 83 | assert_equal "User features", DocSection.find('user').title |
84 | + assert_equal "Content Management", DocSection.find('cms').title | |
85 | 85 | end |
86 | 86 | |
87 | 87 | should 'load null section (the root)' do | ... | ... |