Commit ff2b2b83fa462c3509f575949f0f3f3ea0c1001b

Authored by Vitor Barbosa de Araujo
Committed by Fabio Teixeira
1 parent 8f633a81

Change default parent directory for cloned article

Signed-off-by: André Bernardes <andrebsguedes@gmail.com>
Signed-off-by: DylanGuedes <djmgguedes@gmail.com>
Signed-off-by: Omar Júnior <omarroinuj@gmail.com>
Signed-off-by: Vítor Barbosa <vitornga15@gmail.com>
app/models/article.rb
... ... @@ -605,7 +605,6 @@ class Article &lt; ActiveRecord::Base
605 605 ATTRIBUTES_NOT_COPIED = [
606 606 :id,
607 607 :profile_id,
608   - :parent_id,
609 608 :path,
610 609 :slug,
611 610 :updated_at,
... ...
test/unit/clone_article_test.rb 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +require_relative "../test_helper"
  2 +
  3 +class CloneArticleTest < ActiveSupport::TestCase
  4 +
  5 + should 'cloned article have its source attributes' do
  6 + community = fast_create(Community)
  7 + folder = fast_create(Folder, :profile_id => community.id)
  8 + article = fast_create(TinyMceArticle, :profile_id => community.id)
  9 + article.parent_id = folder.id
  10 + article.save!
  11 +
  12 + article.reload
  13 + cloned_article = article.copy_without_save
  14 +
  15 + assert_equal folder.id, cloned_article.parent_id
  16 + assert_equal article.body , cloned_article.body
  17 + assert_equal article.name, cloned_article.name
  18 + assert_equal article.setting, cloned_article.setting
  19 + end
  20 +
  21 +end
0 22 \ No newline at end of file
... ...