From 9ecadfd9169c6d349d61549691352d14f3bc2885 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Tue, 14 Jul 2015 17:39:22 -0300 Subject: [PATCH] Fix tests --- test/unit/api_test.rb | 2 ++ test/unit/proposal_task_test.rb | 18 ++++++++++++++++++ test/unit/proposal_test.rb | 15 --------------- 3 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 test/unit/proposal_task_test.rb diff --git a/test/unit/api_test.rb b/test/unit/api_test.rb index 9399eb6..59f9996 100644 --- a/test/unit/api_test.rb +++ b/test/unit/api_test.rb @@ -5,6 +5,8 @@ class APITest < ActiveSupport::TestCase def setup login_api + environment = Environment.default + environment.enable_plugin(ProposalsDiscussionPlugin) end should 'return proposal ranking' do diff --git a/test/unit/proposal_task_test.rb b/test/unit/proposal_task_test.rb new file mode 100644 index 0000000..dbdb37c --- /dev/null +++ b/test/unit/proposal_task_test.rb @@ -0,0 +1,18 @@ +require_relative '../test_helper' + +class ProposalTaskTest < ActiveSupport::TestCase + + attr_reader :profile, :proposal, :person, :discussion + + def setup + @person = fast_create(Person) + @discussion = ProposalsDiscussionPlugin::Discussion.create!(:name => 'discussion', :profile => person, :allow_topics => false) + end + + should 'check the source of a proposal in a task' do + topic = fast_create(ProposalsDiscussionPlugin::Topic, :parent_id => discussion.id) + task = ProposalsDiscussionPlugin::ProposalTask.new(:article_parent_id => topic.id) + assert_equal topic.name, task.proposal_source + end + +end diff --git a/test/unit/proposal_test.rb b/test/unit/proposal_test.rb index 78a278a..877bfdc 100644 --- a/test/unit/proposal_test.rb +++ b/test/unit/proposal_test.rb @@ -124,19 +124,4 @@ class ProposalTest < ActiveSupport::TestCase assert_equal [location], proposal.locations end - should 'check the source of a proposal in a task' do - - task_data = { - article: {name: "test proposal", abstract: "teste adadd"}, - requestor: person, - target: profile, - spam: false - } - - task = ProposalsDiscussionPlugin::ProposalTask.new task_data - - assert_equal task_data[:article][:name], task.proposal_source - - end - end -- libgit2 0.21.2