Commit 79d0e8baab1d5edfbffb53052558b327688b3339
1 parent
2dbfdebd
Exists in
master
and in
29 other branches
rails3: fix some controller tests
getterm (and __) was replaced by _ (commit 86ecb14f)
Showing
9 changed files
with
14 additions
and
19 deletions
Show diff stats
app/controllers/public/search_controller.rb
@@ -29,7 +29,7 @@ class SearchController < PublicController | @@ -29,7 +29,7 @@ class SearchController < PublicController | ||
29 | @asset = key | 29 | @asset = key |
30 | send(key) | 30 | send(key) |
31 | @order << key | 31 | @order << key |
32 | - @names[key] = getterm(description) | 32 | + @names[key] = _(description) |
33 | end | 33 | end |
34 | @asset = nil | 34 | @asset = nil |
35 | 35 |
app/helpers/application_helper.rb
@@ -796,7 +796,7 @@ module ApplicationHelper | @@ -796,7 +796,7 @@ module ApplicationHelper | ||
796 | end | 796 | end |
797 | } | 797 | } |
798 | html += "<br />\n".html_safe if line_size == 0 || ( values.size % line_size ) > 0 | 798 | html += "<br />\n".html_safe if line_size == 0 || ( values.size % line_size ) > 0 |
799 | - column = object.class.columns_hash[method.to_s] | 799 | + column = object.class.columns_hash[method.to_s] if object |
800 | text = | 800 | text = |
801 | ( column ? | 801 | ( column ? |
802 | column.human_name : | 802 | column.human_name : |
@@ -1425,7 +1425,7 @@ module ApplicationHelper | @@ -1425,7 +1425,7 @@ module ApplicationHelper | ||
1425 | object = instance_variable_get("@#{name}") | 1425 | object = instance_variable_get("@#{name}") |
1426 | object.errors.full_messages.each do |msg| | 1426 | object.errors.full_messages.each do |msg| |
1427 | errors << msg | 1427 | errors << msg |
1428 | - end | 1428 | + end if object |
1429 | end | 1429 | end |
1430 | return '' if errors.empty? | 1430 | return '' if errors.empty? |
1431 | 1431 | ||
@@ -1437,11 +1437,6 @@ module ApplicationHelper | @@ -1437,11 +1437,6 @@ module ApplicationHelper | ||
1437 | end | 1437 | end |
1438 | end | 1438 | end |
1439 | 1439 | ||
1440 | - # FIXME | ||
1441 | - def observe_field(*args) | ||
1442 | - '' | ||
1443 | - end | ||
1444 | - | ||
1445 | def private_profile_partial_parameters | 1440 | def private_profile_partial_parameters |
1446 | if profile.person? | 1441 | if profile.person? |
1447 | @action = :add_friend | 1442 | @action = :add_friend |
app/helpers/forum_helper.rb
@@ -36,7 +36,7 @@ module ForumHelper | @@ -36,7 +36,7 @@ module ForumHelper | ||
36 | :id => "post-#{art.id}" | 36 | :id => "post-#{art.id}" |
37 | ) | 37 | ) |
38 | } | 38 | } |
39 | - content_tag('table', content) + (pagination or '') | 39 | + content_tag('table', content.join) + (pagination or '') |
40 | end | 40 | end |
41 | 41 | ||
42 | def last_topic_update(article) | 42 | def last_topic_update(article) |
app/helpers/language_helper.rb
@@ -22,7 +22,7 @@ module LanguageHelper | @@ -22,7 +22,7 @@ module LanguageHelper | ||
22 | if options[:element] == 'dropdown' | 22 | if options[:element] == 'dropdown' |
23 | select_tag('lang', | 23 | select_tag('lang', |
24 | options_for_select(locales.map{|code,name| [name, code]}, current), | 24 | options_for_select(locales.map{|code,name| [name, code]}, current), |
25 | - :onchange => "document.location.href= #{url_for(params.merge(:lang => 'LANGUAGE')).inspect}.replace(/LANGUAGE/, this.value) ;", | 25 | + :onchange => "document.location.href= #{url_for(params.merge(:lang => 'LANGUAGE'))}.replace(/LANGUAGE/, this.value) ;", |
26 | :help => _('The language you choose here is the language used for options, buttons, etc. It does not affect the language of the content created by other users.') | 26 | :help => _('The language you choose here is the language used for options, buttons, etc. It does not affect the language of the content created by other users.') |
27 | ) | 27 | ) |
28 | else | 28 | else |
app/models/link_list_block.rb
@@ -58,7 +58,7 @@ class LinkListBlock < Block | @@ -58,7 +58,7 @@ class LinkListBlock < Block | ||
58 | def content(args={}) | 58 | def content(args={}) |
59 | block_title(title) + | 59 | block_title(title) + |
60 | content_tag('ul', | 60 | content_tag('ul', |
61 | - links.select{|i| !i[:name].blank? and !i[:address].blank?}.map{|i| content_tag('li', link_html(i))}.join(',') | 61 | + links.select{|i| !i[:name].blank? and !i[:address].blank?}.map{|i| content_tag('li', link_html(i))}.join |
62 | ) | 62 | ) |
63 | end | 63 | end |
64 | 64 |
app/views/cms/select_article_type.html.erb
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <ul class="article-types"> | 5 | <ul class="article-types"> |
6 | <% for type in @article_types %> | 6 | <% for type in @article_types %> |
7 | <% action = type[:class].name == 'UploadedFile' ? {:action => 'upload_files'} : {:action => 'new', :type => type[:class].name} %> | 7 | <% action = type[:class].name == 'UploadedFile' ? {:action => 'upload_files'} : {:action => 'new', :type => type[:class].name} %> |
8 | - <% content_tag('a', :href => url_for(action.merge(:parent_id => @parent_id, :back_to => @back_to))) do %> | 8 | + <%= content_tag('a', :href => url_for(action.merge(:parent_id => @parent_id, :back_to => @back_to))) do %> |
9 | <li class="<%= icon_for_new_article(type[:class]) %>" onmouseover="javascript: jQuery(this).addClass('mouseover')" onmouseout="jQuery(this).removeClass('mouseover')"> | 9 | <li class="<%= icon_for_new_article(type[:class]) %>" onmouseover="javascript: jQuery(this).addClass('mouseover')" onmouseout="jQuery(this).removeClass('mouseover')"> |
10 | <strong><%= type[:short_description] %></strong> | 10 | <strong><%= type[:short_description] %></strong> |
11 | <div class='description'><%= type[:description] %></div> | 11 | <div class='description'><%= type[:description] %></div> |
app/views/profile_editor/_pending_tasks.html.erb
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | <div class='pending-tasks'> | 4 | <div class='pending-tasks'> |
5 | <h2><%= _('You have pending requests') %></h2> | 5 | <h2><%= _('You have pending requests') %></h2> |
6 | <ul> | 6 | <ul> |
7 | - <%= @pending_tasks.map {|task| content_tag('li', task_information(task))} %> | 7 | + <%= @pending_tasks.map {|task| content_tag('li', task_information(task))}.join %> |
8 | </ul> | 8 | </ul> |
9 | <%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %> | 9 | <%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %> |
10 | </div> | 10 | </div> |
app/views/shared/_list_groups.html.erb
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | <span class='profile-details'> | 7 | <span class='profile-details'> |
8 | <strong><%= group.name %></strong><br/> | 8 | <strong><%= group.name %></strong><br/> |
9 | <%= _('Role: %s') % rolename_for(profile, group) + '<br/>' if profile.role_assignments.find_by_resource_id(group.id) %> | 9 | <%= _('Role: %s') % rolename_for(profile, group) + '<br/>' if profile.role_assignments.find_by_resource_id(group.id) %> |
10 | - <%= _('Type: %s') % getterm(group.class.identification) %> <br/> | 10 | + <%= _('Type: %s') % _(group.class.identification) %> <br/> |
11 | <%= _('Description: %s') % group.description + '<br/>' if group.community? %> | 11 | <%= _('Description: %s') % group.description + '<br/>' if group.community? %> |
12 | <%= _('Members: %s') % group.members_count.to_s %> <br/> | 12 | <%= _('Members: %s') % group.members_count.to_s %> <br/> |
13 | <%= _('Created at: %s') % show_date(group.created_at) unless group.enterprise? %> <br/> | 13 | <%= _('Created at: %s') % show_date(group.created_at) unless group.enterprise? %> <br/> |
test/functional/search_controller_test.rb
@@ -59,7 +59,7 @@ class SearchControllerTest < ActionController::TestCase | @@ -59,7 +59,7 @@ class SearchControllerTest < ActionController::TestCase | ||
59 | 59 | ||
60 | should 'search only in specified types of content' do | 60 | should 'search only in specified types of content' do |
61 | get :articles, :query => 'something not important' | 61 | get :articles, :query => 'something not important' |
62 | - assert_equal [:articles], assigns(:searches).keys | 62 | + assert_equal ['articles'], assigns(:searches).keys |
63 | end | 63 | end |
64 | 64 | ||
65 | should 'render success in search' do | 65 | should 'render success in search' do |
@@ -155,13 +155,13 @@ class SearchControllerTest < ActionController::TestCase | @@ -155,13 +155,13 @@ class SearchControllerTest < ActionController::TestCase | ||
155 | should 'include extra content supplied by plugins on product asset' do | 155 | should 'include extra content supplied by plugins on product asset' do |
156 | class Plugin1 < Noosfero::Plugin | 156 | class Plugin1 < Noosfero::Plugin |
157 | def asset_product_extras(product) | 157 | def asset_product_extras(product) |
158 | - lambda {"<span id='plugin1'>This is Plugin1 speaking!</span>"} | 158 | + proc {"<span id='plugin1'>This is Plugin1 speaking!</span>"} |
159 | end | 159 | end |
160 | end | 160 | end |
161 | 161 | ||
162 | class Plugin2 < Noosfero::Plugin | 162 | class Plugin2 < Noosfero::Plugin |
163 | def asset_product_extras(product) | 163 | def asset_product_extras(product) |
164 | - lambda {"<span id='plugin2'>This is Plugin2 speaking!</span>"} | 164 | + proc {"<span id='plugin2'>This is Plugin2 speaking!</span>"} |
165 | end | 165 | end |
166 | end | 166 | end |
167 | 167 | ||
@@ -182,12 +182,12 @@ class SearchControllerTest < ActionController::TestCase | @@ -182,12 +182,12 @@ class SearchControllerTest < ActionController::TestCase | ||
182 | should 'include extra properties of the product supplied by plugins' do | 182 | should 'include extra properties of the product supplied by plugins' do |
183 | class Plugin1 < Noosfero::Plugin | 183 | class Plugin1 < Noosfero::Plugin |
184 | def asset_product_properties(product) | 184 | def asset_product_properties(product) |
185 | - return { :name => _('Property1'), :content => lambda { link_to(product.name, '/plugin1') } } | 185 | + return { :name => _('Property1'), :content => proc { link_to(product.name, '/plugin1') } } |
186 | end | 186 | end |
187 | end | 187 | end |
188 | class Plugin2 < Noosfero::Plugin | 188 | class Plugin2 < Noosfero::Plugin |
189 | def asset_product_properties(product) | 189 | def asset_product_properties(product) |
190 | - return { :name => _('Property2'), :content => lambda { link_to(product.name, '/plugin2') } } | 190 | + return { :name => _('Property2'), :content => proc { link_to(product.name, '/plugin2') } } |
191 | end | 191 | end |
192 | end | 192 | end |
193 | enterprise = fast_create(Enterprise) | 193 | enterprise = fast_create(Enterprise) |