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
@@ -362,6 +362,7 @@ module ApplicationHelper | @@ -362,6 +362,7 @@ module ApplicationHelper | ||
362 | return render :file => file, :use_full_path => false | 362 | return render :file => file, :use_full_path => false |
363 | end | 363 | end |
364 | end | 364 | end |
365 | + nil | ||
365 | end | 366 | end |
366 | 367 | ||
367 | def theme_header | 368 | def theme_header |
test/functional/doc_controller_test.rb
@@ -23,20 +23,20 @@ class DocControllerTest < ActionController::TestCase | @@ -23,20 +23,20 @@ class DocControllerTest < ActionController::TestCase | ||
23 | end | 23 | end |
24 | 24 | ||
25 | should 'translate section' do | 25 | should 'translate section' do |
26 | - get :section, :section => 'admin' | 26 | + get :section, :section => 'user' |
27 | assert_equal 'en', assigns(:section).language | 27 | assert_equal 'en', assigns(:section).language |
28 | 28 | ||
29 | @controller.stubs(:language).returns('pt') | 29 | @controller.stubs(:language).returns('pt') |
30 | - get :section, :section => 'admin' | 30 | + get :section, :section => 'user' |
31 | assert_equal 'pt', assigns(:section).language | 31 | assert_equal 'pt', assigns(:section).language |
32 | end | 32 | end |
33 | 33 | ||
34 | should 'translate topic' do | 34 | should 'translate topic' do |
35 | - get :topic, :section => 'admin', :topic => '100-email' | 35 | + get :topic, :section => 'user', :topic => 'accepting-friends' |
36 | assert_equal 'en', assigns(:topic).language | 36 | assert_equal 'en', assigns(:topic).language |
37 | 37 | ||
38 | @controller.stubs(:language).returns('pt') | 38 | @controller.stubs(:language).returns('pt') |
39 | - get :topic, :section => 'admin', :topic => '100-email' | 39 | + get :topic, :section => 'user', :topic => 'accepting-friends' |
40 | assert_equal 'pt', assigns(:topic).language | 40 | assert_equal 'pt', assigns(:topic).language |
41 | end | 41 | end |
42 | 42 |
test/unit/application_helper_test.rb
@@ -170,8 +170,10 @@ class ApplicationHelperTest < Test::Unit::TestCase | @@ -170,8 +170,10 @@ class ApplicationHelperTest < Test::Unit::TestCase | ||
170 | should 'ignore unexisting theme footer' do | 170 | should 'ignore unexisting theme footer' do |
171 | stubs(:theme_path).returns('/user_themes/mytheme') | 171 | stubs(:theme_path).returns('/user_themes/mytheme') |
172 | footer_path = RAILS_ROOT + '/public/user_themes/mytheme/footer.rhtml' | 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 | File.expects(:exists?).with(footer_path).returns(false) | 175 | File.expects(:exists?).with(footer_path).returns(false) |
176 | + File.expects(:exists?).with(alternate_footer_path).returns(false) | ||
175 | expects(:render).with(:file => footer).never | 177 | expects(:render).with(:file => footer).never |
176 | 178 | ||
177 | assert_nil theme_footer | 179 | assert_nil theme_footer |
test/unit/doc_section_test.rb
@@ -21,7 +21,7 @@ class DocSectionTest < ActiveSupport::TestCase | @@ -21,7 +21,7 @@ class DocSectionTest < ActiveSupport::TestCase | ||
21 | should 'list available sections' do | 21 | should 'list available sections' do |
22 | sections = DocSection.all | 22 | sections = DocSection.all |
23 | assert(sections.size > 0, 'should load sections ') | 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 | assert(sections.find { |item| item.title == 'User features'}, 'should find section "User features"') | 25 | assert(sections.find { |item| item.title == 'User features'}, 'should find section "User features"') |
26 | end | 26 | end |
27 | 27 | ||
@@ -30,7 +30,7 @@ class DocSectionTest < ActiveSupport::TestCase | @@ -30,7 +30,7 @@ class DocSectionTest < ActiveSupport::TestCase | ||
30 | # break. If those translations change, this test will also break. | 30 | # break. If those translations change, this test will also break. |
31 | should 'list section for a given language' do | 31 | should 'list section for a given language' do |
32 | sections = DocSection.all('pt') | 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 | assert(sections.find { |item| item.title == 'Funcionalidades de Usuário'}, 'should find section "User features" translated') | 34 | assert(sections.find { |item| item.title == 'Funcionalidades de Usuário'}, 'should find section "User features" translated') |
35 | end | 35 | end |
36 | 36 | ||
@@ -46,28 +46,28 @@ class DocSectionTest < ActiveSupport::TestCase | @@ -46,28 +46,28 @@ class DocSectionTest < ActiveSupport::TestCase | ||
46 | # This test also depends on the existance of specific documentation sections. | 46 | # This test also depends on the existance of specific documentation sections. |
47 | # The same conditions as the above tests apply. | 47 | # The same conditions as the above tests apply. |
48 | should 'list items' do | 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 | assert section.items.size > 0, "should load at least one item" | 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 | end | 53 | end |
54 | 54 | ||
55 | # This test assumes ... (yada, yada, yada, the same as above) | 55 | # This test assumes ... (yada, yada, yada, the same as above) |
56 | should 'load translated items' do | 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 | assert section.items.size > 0, "should load at least one item" | 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 | end | 61 | end |
62 | 62 | ||
63 | # This test assumes that Klingon (tlh) is not supported. If Noosfero does get | 63 | # This test assumes that Klingon (tlh) is not supported. If Noosfero does get |
64 | # aa Klingon translation, then this test will fail | 64 | # aa Klingon translation, then this test will fail |
65 | should 'fallback to load original items when translation is not available' do | 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 | end | 71 | end |
72 | 72 | ||
73 | should 'find in items' do | 73 | should 'find in items' do |
@@ -80,8 +80,8 @@ class DocSectionTest < ActiveSupport::TestCase | @@ -80,8 +80,8 @@ class DocSectionTest < ActiveSupport::TestCase | ||
80 | end | 80 | end |
81 | 81 | ||
82 | should 'be able to find section by its id' do | 82 | should 'be able to find section by its id' do |
83 | - assert_equal "Administration", DocSection.find('admin').title | ||
84 | assert_equal "User features", DocSection.find('user').title | 83 | assert_equal "User features", DocSection.find('user').title |
84 | + assert_equal "Content Management", DocSection.find('cms').title | ||
85 | end | 85 | end |
86 | 86 | ||
87 | should 'load null section (the root)' do | 87 | should 'load null section (the root)' do |