Commit 9ecadfd9169c6d349d61549691352d14f3bc2885

Authored by Victor Costa
1 parent 7b7d1cf0

Fix tests

test/unit/api_test.rb
... ... @@ -5,6 +5,8 @@ class APITest < ActiveSupport::TestCase
5 5  
6 6 def setup
7 7 login_api
  8 + environment = Environment.default
  9 + environment.enable_plugin(ProposalsDiscussionPlugin)
8 10 end
9 11  
10 12 should 'return proposal ranking' do
... ...
test/unit/proposal_task_test.rb 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +require_relative '../test_helper'
  2 +
  3 +class ProposalTaskTest < ActiveSupport::TestCase
  4 +
  5 + attr_reader :profile, :proposal, :person, :discussion
  6 +
  7 + def setup
  8 + @person = fast_create(Person)
  9 + @discussion = ProposalsDiscussionPlugin::Discussion.create!(:name => 'discussion', :profile => person, :allow_topics => false)
  10 + end
  11 +
  12 + should 'check the source of a proposal in a task' do
  13 + topic = fast_create(ProposalsDiscussionPlugin::Topic, :parent_id => discussion.id)
  14 + task = ProposalsDiscussionPlugin::ProposalTask.new(:article_parent_id => topic.id)
  15 + assert_equal topic.name, task.proposal_source
  16 + end
  17 +
  18 +end
... ...
test/unit/proposal_test.rb
... ... @@ -124,19 +124,4 @@ class ProposalTest &lt; ActiveSupport::TestCase
124 124 assert_equal [location], proposal.locations
125 125 end
126 126  
127   - should 'check the source of a proposal in a task' do
128   -
129   - task_data = {
130   - article: {name: "test proposal", abstract: "teste adadd"},
131   - requestor: person,
132   - target: profile,
133   - spam: false
134   - }
135   -
136   - task = ProposalsDiscussionPlugin::ProposalTask.new task_data
137   -
138   - assert_equal task_data[:article][:name], task.proposal_source
139   -
140   - end
141   -
142 127 end
... ...