Commit 79d0e8baab1d5edfbffb53052558b327688b3339
1 parent
2dbfdebd
Exists in
master
and in
22 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
app/helpers/application_helper.rb
| ... | ... | @@ -796,7 +796,7 @@ module ApplicationHelper |
| 796 | 796 | end |
| 797 | 797 | } |
| 798 | 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 | 800 | text = |
| 801 | 801 | ( column ? |
| 802 | 802 | column.human_name : |
| ... | ... | @@ -1425,7 +1425,7 @@ module ApplicationHelper |
| 1425 | 1425 | object = instance_variable_get("@#{name}") |
| 1426 | 1426 | object.errors.full_messages.each do |msg| |
| 1427 | 1427 | errors << msg |
| 1428 | - end | |
| 1428 | + end if object | |
| 1429 | 1429 | end |
| 1430 | 1430 | return '' if errors.empty? |
| 1431 | 1431 | |
| ... | ... | @@ -1437,11 +1437,6 @@ module ApplicationHelper |
| 1437 | 1437 | end |
| 1438 | 1438 | end |
| 1439 | 1439 | |
| 1440 | - # FIXME | |
| 1441 | - def observe_field(*args) | |
| 1442 | - '' | |
| 1443 | - end | |
| 1444 | - | |
| 1445 | 1440 | def private_profile_partial_parameters |
| 1446 | 1441 | if profile.person? |
| 1447 | 1442 | @action = :add_friend | ... | ... |
app/helpers/forum_helper.rb
app/helpers/language_helper.rb
| ... | ... | @@ -22,7 +22,7 @@ module LanguageHelper |
| 22 | 22 | if options[:element] == 'dropdown' |
| 23 | 23 | select_tag('lang', |
| 24 | 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 | 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 | 28 | else | ... | ... |
app/models/link_list_block.rb
| ... | ... | @@ -58,7 +58,7 @@ class LinkListBlock < Block |
| 58 | 58 | def content(args={}) |
| 59 | 59 | block_title(title) + |
| 60 | 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 | 63 | end |
| 64 | 64 | ... | ... |
app/views/cms/select_article_type.html.erb
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | <ul class="article-types"> |
| 6 | 6 | <% for type in @article_types %> |
| 7 | 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 | 9 | <li class="<%= icon_for_new_article(type[:class]) %>" onmouseover="javascript: jQuery(this).addClass('mouseover')" onmouseout="jQuery(this).removeClass('mouseover')"> |
| 10 | 10 | <strong><%= type[:short_description] %></strong> |
| 11 | 11 | <div class='description'><%= type[:description] %></div> | ... | ... |
app/views/profile_editor/_pending_tasks.html.erb
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | <div class='pending-tasks'> |
| 5 | 5 | <h2><%= _('You have pending requests') %></h2> |
| 6 | 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 | 8 | </ul> |
| 9 | 9 | <%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %> |
| 10 | 10 | </div> | ... | ... |
app/views/shared/_list_groups.html.erb
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | <span class='profile-details'> |
| 8 | 8 | <strong><%= group.name %></strong><br/> |
| 9 | 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 | 11 | <%= _('Description: %s') % group.description + '<br/>' if group.community? %> |
| 12 | 12 | <%= _('Members: %s') % group.members_count.to_s %> <br/> |
| 13 | 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 | 59 | |
| 60 | 60 | should 'search only in specified types of content' do |
| 61 | 61 | get :articles, :query => 'something not important' |
| 62 | - assert_equal [:articles], assigns(:searches).keys | |
| 62 | + assert_equal ['articles'], assigns(:searches).keys | |
| 63 | 63 | end |
| 64 | 64 | |
| 65 | 65 | should 'render success in search' do |
| ... | ... | @@ -155,13 +155,13 @@ class SearchControllerTest < ActionController::TestCase |
| 155 | 155 | should 'include extra content supplied by plugins on product asset' do |
| 156 | 156 | class Plugin1 < Noosfero::Plugin |
| 157 | 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 | 159 | end |
| 160 | 160 | end |
| 161 | 161 | |
| 162 | 162 | class Plugin2 < Noosfero::Plugin |
| 163 | 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 | 165 | end |
| 166 | 166 | end |
| 167 | 167 | |
| ... | ... | @@ -182,12 +182,12 @@ class SearchControllerTest < ActionController::TestCase |
| 182 | 182 | should 'include extra properties of the product supplied by plugins' do |
| 183 | 183 | class Plugin1 < Noosfero::Plugin |
| 184 | 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 | 186 | end |
| 187 | 187 | end |
| 188 | 188 | class Plugin2 < Noosfero::Plugin |
| 189 | 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 | 191 | end |
| 192 | 192 | end |
| 193 | 193 | enterprise = fast_create(Enterprise) | ... | ... |