From 1c48e726ee3f71273daf7fca70fd84ad98006e03 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Thu, 27 Aug 2015 16:17:31 -0300 Subject: [PATCH] fixing unit tests --- plugins/community_track/lib/community_track_plugin/step.rb | 11 ++++++++--- plugins/community_track/test/unit/community_track_plugin/track_test.rb | 9 +++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/community_track/lib/community_track_plugin/step.rb b/plugins/community_track/lib/community_track_plugin/step.rb index c81f380..3f7c9cc 100644 --- a/plugins/community_track/lib/community_track_plugin/step.rb +++ b/plugins/community_track/lib/community_track_plugin/step.rb @@ -60,9 +60,14 @@ class CommunityTrackPlugin::Step < Folder accept_comments end - def self.enabled_tools - [TinyMceArticle, Forum] - end + def enabled_tools + tools = [TinyMceArticle, Forum] + tools << CommunityHubPlugin::Hub if environment.plugin_enabled?('CommunityHubPlugin') + tools << ProposalsDiscussionPlugin::Discussion if environment.plugin_enabled?('ProposalsDiscussionPlugin') + tools << PairwisePlugin::PairwiseContent if environment.plugin_enabled?('PairwisePlugin') + tools + end + def to_html(options = {}) step = self diff --git a/plugins/community_track/test/unit/community_track_plugin/track_test.rb b/plugins/community_track/test/unit/community_track_plugin/track_test.rb index 71fb637..9172514 100644 --- a/plugins/community_track/test/unit/community_track_plugin/track_test.rb +++ b/plugins/community_track/test/unit/community_track_plugin/track_test.rb @@ -5,7 +5,7 @@ class TrackTest < ActiveSupport::TestCase def setup @profile = create(Community) @track = create_track('track', @profile) - @step = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => Date.today, :end_date => Date.today, :name => 'step', :profile => @profile) + @step = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => DateTime.now, :end_date => DateTime.now, :name => 'step', :profile => @profile) @track.children << @step @tool = fast_create(Article, :parent_id => @step.id, :profile_id => @profile.id) @step.children << @tool @@ -30,14 +30,14 @@ class TrackTest < ActiveSupport::TestCase @track.children << @step @step.children << article comment = create(Comment, :source => article, :author_id => owner.id) - @step2 = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => Date.today, :end_date => Date.today, :name => 'step2', :profile => @profile) + @step2 = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => DateTime.now, :end_date => DateTime.now, :name => 'step2', :profile => @profile) @step2.tool_type = 'Forum' forum = fast_create(Forum, :parent_id => @step2.id) article_forum = create(Article, :name => 'article_forum', :parent_id => forum.id, :profile_id => owner.id) forum.children << article_forum forum_comment = create(Comment, :source => article_forum, :author_id => owner.id) - @track.stubs(:children).returns([@step, @step2]) - #@track.children = [@step, @step2] + @track.children = [@step, @step2] + @track = Article.find(@track.id) assert_equal 2, @track.comments_count end @@ -47,6 +47,7 @@ class TrackTest < ActiveSupport::TestCase should 'do not return other articles type at steps' do article = fast_create(Article, :parent_id => @track.id, :profile_id => @track.profile.id) + @track = Article.find(@track.id) assert_includes @track.children, article assert_equal [@step], @track.steps_unsorted end -- libgit2 0.21.2