ref: master
plugins/community_track/test/unit/article_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
require_relative '../test_helper' class ArticleTest < ActiveSupport::TestCase def setup @profile = fast_create(Community) @track = create_track('track', @profile) @step = CommunityTrackPlugin::Step.create!(:name => 'Step', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => Date.today, :start_date => Date.today) end should 'inherit accept_comments from parent if it is a step' do @step.accept_comments = true @step.save! article = Article.create!(:parent => @step, :profile => @profile, :accept_comments => false, :name => "article") assert article.accept_comments end should 'do nothing if parent is not a step' do folder = fast_create(Folder, :profile_id => @profile.id) article = Article.create!(:parent => folder, :profile => @profile, :accept_comments => false, :name => "article") refute article.accept_comments end end |