Commit 20f677b2dd5798f7fd960d3e10d625b532e88bbf
Committed by
Daniela Feitosa
1 parent
58212a86
Exists in
master
and in
29 other branches
Not copy 'slug' when approve article
(ActionItem1926)
Showing
3 changed files
with
30 additions
and
2 deletions
Show diff stats
app/models/article.rb
@@ -417,6 +417,7 @@ class Article < ActiveRecord::Base | @@ -417,6 +417,7 @@ class Article < ActiveRecord::Base | ||
417 | :profile_id, | 417 | :profile_id, |
418 | :parent_id, | 418 | :parent_id, |
419 | :path, | 419 | :path, |
420 | + :slug, | ||
420 | :updated_at, | 421 | :updated_at, |
421 | :created_at, | 422 | :created_at, |
422 | :last_changed_by_id, | 423 | :last_changed_by_id, |
test/unit/approve_article_test.rb
@@ -378,4 +378,31 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -378,4 +378,31 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
378 | end | 378 | end |
379 | end | 379 | end |
380 | 380 | ||
381 | + should 'approve same article twice changing its name' do | ||
382 | + task1 = ApproveArticle.create!(:article => article, :target => community, :requestor => profile) | ||
383 | + assert_difference article.class, :count do | ||
384 | + task1.finish | ||
385 | + end | ||
386 | + task2 = ApproveArticle.create!(:name => article.name + ' v2', :article => article, :target => community, :requestor => profile) | ||
387 | + assert_difference article.class, :count do | ||
388 | + assert_nothing_raised ActiveRecord::RecordInvalid do | ||
389 | + task2.finish | ||
390 | + end | ||
391 | + end | ||
392 | + end | ||
393 | + | ||
394 | + should 'not approve same article twice if not changing its name' do | ||
395 | + task1 = ApproveArticle.create!(:article => article, :target => community, :requestor => profile) | ||
396 | + assert_difference article.class, :count do | ||
397 | + task1.finish | ||
398 | + end | ||
399 | + task2 = ApproveArticle.create!(:article => article, :target => community, :requestor => profile) | ||
400 | + assert_no_difference article.class, :count do | ||
401 | + assert_raises ActiveRecord::RecordInvalid do | ||
402 | + task2.finish | ||
403 | + end | ||
404 | + end | ||
405 | + end | ||
406 | + | ||
407 | + | ||
381 | end | 408 | end |
test/unit/article_test.rb
@@ -576,10 +576,10 @@ class ArticleTest < Test::Unit::TestCase | @@ -576,10 +576,10 @@ class ArticleTest < Test::Unit::TestCase | ||
576 | assert_kind_of Folder, b | 576 | assert_kind_of Folder, b |
577 | end | 577 | end |
578 | 578 | ||
579 | - should 'copy slug' do | 579 | + should 'not copy slug' do |
580 | a = fast_create(Article, :slug => 'slug123') | 580 | a = fast_create(Article, :slug => 'slug123') |
581 | b = a.copy({}) | 581 | b = a.copy({}) |
582 | - assert_equal a.slug, b.slug | 582 | + assert a.slug != b.slug |
583 | end | 583 | end |
584 | 584 | ||
585 | should 'load article under an old path' do | 585 | should 'load article under an old path' do |