From 20ac104d8a2654774a475c90f95f09dce1a86e55 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Wed, 10 Jun 2009 21:19:50 -0300 Subject: [PATCH] ActionItem1111: in postgres, when search for blank there was a crash --- app/models/approve_article.rb | 2 +- test/functional/tasks_controller_test.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/models/approve_article.rb b/app/models/approve_article.rb index 6998a35..31e134f 100644 --- a/app/models/approve_article.rb +++ b/app/models/approve_article.rb @@ -44,7 +44,7 @@ class ApproveArticle < Task end def article_parent - Article.find_by_id article_parent_id + Article.find_by_id article_parent_id.to_i end def article_parent= value diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index 965d105..37737d9 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -191,4 +191,16 @@ class TasksControllerTest < Test::Unit::TestCase assert_equal true, PublishedArticle.find(:first).highlighted end + should 'create published article after choosing root folder on approve article task' do + PublishedArticle.destroy_all + c = Community.create!(:name => 'test comm', :moderated_articles => false) + @controller.stubs(:profile).returns(c) + c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) + article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails') + t = ApproveArticle.create!(:name => 'test name', :article => article, :target => c, :requestor => profile) + + post :close, :decision => 'finish', :id => t.id, :task => { :name => 'new_name', :article_parent_id => ""} + assert_not_nil PublishedArticle.find(:first) + end + end -- libgit2 0.21.2