Commit ff2b2b83fa462c3509f575949f0f3f3ea0c1001b
Committed by
Fabio Teixeira
1 parent
8f633a81
Exists in
fix_cloned_article_parent
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>
Showing
2 changed files
with
21 additions
and
1 deletions
Show diff stats
app/models/article.rb
| @@ -605,7 +605,6 @@ class Article < ActiveRecord::Base | @@ -605,7 +605,6 @@ class Article < ActiveRecord::Base | ||
| 605 | ATTRIBUTES_NOT_COPIED = [ | 605 | ATTRIBUTES_NOT_COPIED = [ |
| 606 | :id, | 606 | :id, |
| 607 | :profile_id, | 607 | :profile_id, |
| 608 | - :parent_id, | ||
| 609 | :path, | 608 | :path, |
| 610 | :slug, | 609 | :slug, |
| 611 | :updated_at, | 610 | :updated_at, |
| @@ -0,0 +1,21 @@ | @@ -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 | \ No newline at end of file | 22 | \ No newline at end of file |