cirandas.net

ref: master

test/unit/clone_article_test.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
require_relative "../test_helper"

class CloneArticleTest < ActiveSupport::TestCase

  should 'cloned article have its source attributes' do
    community = fast_create(Community)
    folder = fast_create(Folder, :profile_id => community.id)
    article = fast_create(TextArticle, :profile_id => community.id)
    article.parent_id = folder.id
    article.save!

    article.reload
    cloned_article = article.copy_without_save({:parent_id => article.parent_id})

    assert_equal folder.id, cloned_article.parent_id
    assert_equal article.body , cloned_article.body
    assert_equal article.name, cloned_article.name
    assert_equal article.setting, cloned_article.setting
  end

end