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