Commit f1279433daa60ac0e729a0c0814a26c7617f5ea1
Committed by
Fabio Teixeira
1 parent
6cc4b538
Exists in
fix_cloned_article_parent
Added cloned article functional test
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Simiao Carvalho <simiaosimis@gmail.com>
Showing
1 changed file
with
23 additions
and
0 deletions
Show diff stats
test/functional/cms_controller_test.rb
@@ -1897,6 +1897,29 @@ class CmsControllerTest < ActionController::TestCase | @@ -1897,6 +1897,29 @@ class CmsControllerTest < ActionController::TestCase | ||
1897 | assert_equal '[{"label":"linux","value":"linux"}]', @response.body | 1897 | assert_equal '[{"label":"linux","value":"linux"}]', @response.body |
1898 | end | 1898 | end |
1899 | 1899 | ||
1900 | + should 'clone an article with its parent' do | ||
1901 | + login_as(profile.identifier) | ||
1902 | + | ||
1903 | + f = Folder.new(:name => 'f') | ||
1904 | + profile.articles << f | ||
1905 | + f.save! | ||
1906 | + | ||
1907 | + post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :parent_id => f.id, | ||
1908 | + :article => { :name => 'Main Article', :body => 'some content' } | ||
1909 | + | ||
1910 | + main_article = profile.articles.find_by_name('Main Article') | ||
1911 | + assert_not_nil main_article | ||
1912 | + | ||
1913 | + post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :parent_id => f.id, | ||
1914 | + :id => main_article.id, :clone => true | ||
1915 | + | ||
1916 | + cloned_main_article = profile.articles.find_by_name('Main Article') | ||
1917 | + assert_not_nil cloned_main_article | ||
1918 | + | ||
1919 | + assert_equal main_article.parent_id, cloned_main_article.parent_id | ||
1920 | + | ||
1921 | + end | ||
1922 | + | ||
1900 | protected | 1923 | protected |
1901 | 1924 | ||
1902 | # FIXME this is to avoid adding an extra dependency for a proper JSON parser. | 1925 | # FIXME this is to avoid adding an extra dependency for a proper JSON parser. |