Commit 86ef31c1e968ce7521b34c74034901b71c1eb6a4
1 parent
00c030b0
Exists in
staging
and in
42 other branches
Handle steps childrend activation
Showing
2 changed files
with
36 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | +require File.dirname(__FILE__) + '/../test_helper' | |
| 2 | + | |
| 3 | +class ArticleTest < ActiveSupport::TestCase | |
| 4 | + | |
| 5 | + def setup | |
| 6 | + @profile = fast_create(Community) | |
| 7 | + @track = create_track('track', @profile) | |
| 8 | + @step = CommunityTrackPlugin::Step.create!(:name => 'Step', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => Date.today, :start_date => Date.today) | |
| 9 | + end | |
| 10 | + | |
| 11 | + should 'inherit accept_comments from parent if it is a step' do | |
| 12 | + @step.accept_comments = true | |
| 13 | + @step.save! | |
| 14 | + article = Article.create!(:parent => @step, :profile => @profile, :accept_comments => false, :name => "article") | |
| 15 | + assert article.accept_comments | |
| 16 | + end | |
| 17 | + | |
| 18 | + should 'do nothing if parent is not a step' do | |
| 19 | + folder = fast_create(Folder, :profile_id => @profile.id) | |
| 20 | + article = Article.create!(:parent => folder, :profile => @profile, :accept_comments => false, :name => "article") | |
| 21 | + assert !article.accept_comments | |
| 22 | + end | |
| 23 | + | |
| 24 | +end | ... | ... |