summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-04 10:03:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-04 10:03:06 +0000
commit4be1c1ad58612349a29aa182e28e1b7d35aacaeb (patch)
treea6ec3b9be7312a84ee13e41a4f064c8ad3a3b145
parenteaf0ea0c23bfd7d3aadda606b3866212a5009a9b (diff)
downloadredmine-4be1c1ad58612349a29aa182e28e1b7d35aacaeb.tar.gz
redmine-4be1c1ad58612349a29aa182e28e1b7d35aacaeb.zip
Merged r2894 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2996 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/views/account/show.rhtml2
-rw-r--r--app/views/projects/show.rhtml2
-rw-r--r--test/functional/account_controller_test.rb12
-rw-r--r--test/functional/projects_controller_test.rb10
4 files changed, 24 insertions, 2 deletions
diff --git a/app/views/account/show.rhtml b/app/views/account/show.rhtml
index 134c587d0..5ebff4455 100644
--- a/app/views/account/show.rhtml
+++ b/app/views/account/show.rhtml
@@ -10,7 +10,7 @@
<li><%=l(:field_mail)%>: <%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></li>
<% end %>
<% for custom_value in @custom_values %>
- <% if !custom_value.value.empty? %>
+ <% if !custom_value.value.blank? %>
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
<% end %>
<% end %>
diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml
index a66964aad..088dd3b40 100644
--- a/app/views/projects/show.rhtml
+++ b/app/views/projects/show.rhtml
@@ -11,7 +11,7 @@
<li><%=l(:field_parent)%>: <%= link_to h(@project.parent.name), :controller => 'projects', :action => 'show', :id => @project.parent %></li>
<% end %>
<% @project.custom_values.each do |custom_value| %>
- <% if !custom_value.value.empty? %>
+ <% if !custom_value.value.blank? %>
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
<% end %>
<% end %>
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index 6dc61d449..344c8365a 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -37,7 +37,19 @@ class AccountControllerTest < Test::Unit::TestCase
assert_template 'show'
assert_not_nil assigns(:user)
end
+
+ def test_show_should_not_fail_when_custom_values_are_nil
+ user = User.find(2)
+
+ # Create a custom field to illustrate the issue
+ custom_field = CustomField.create!(:name => 'Testing', :field_format => 'text')
+ custom_value = user.custom_values.build(:custom_field => custom_field).save!
+
+ get :show, :id => 2
+ assert_response :success
+ end
+
def test_show_inactive
get :show, :id => 5
assert_response 404
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index 8737b3c59..e46e011f9 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -68,6 +68,16 @@ class ProjectsControllerTest < Test::Unit::TestCase
assert_equal Project.find_by_identifier('ecookbook'), assigns(:project)
end
+ def test_show_should_not_fail_when_custom_values_are_nil
+ project = Project.find_by_identifier('ecookbook')
+ project.custom_values.first.update_attribute(:value, nil)
+ get :show, :id => 'ecookbook'
+ assert_response :success
+ assert_template 'show'
+ assert_not_nil assigns(:project)
+ assert_equal Project.find_by_identifier('ecookbook'), assigns(:project)
+ end
+
def test_private_subprojects_hidden
get :show, :id => 'ecookbook'
assert_response :success