Commit 9ecadfd9169c6d349d61549691352d14f3bc2885
1 parent
7b7d1cf0
Exists in
master
and in
7 other branches
Fix tests
Showing
3 changed files
with
20 additions
and
15 deletions
Show diff stats
test/unit/api_test.rb
@@ -5,6 +5,8 @@ class APITest < ActiveSupport::TestCase | @@ -5,6 +5,8 @@ class APITest < ActiveSupport::TestCase | ||
5 | 5 | ||
6 | def setup | 6 | def setup |
7 | login_api | 7 | login_api |
8 | + environment = Environment.default | ||
9 | + environment.enable_plugin(ProposalsDiscussionPlugin) | ||
8 | end | 10 | end |
9 | 11 | ||
10 | should 'return proposal ranking' do | 12 | should 'return proposal ranking' do |
@@ -0,0 +1,18 @@ | @@ -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 < ActiveSupport::TestCase | @@ -124,19 +124,4 @@ class ProposalTest < ActiveSupport::TestCase | ||
124 | assert_equal [location], proposal.locations | 124 | assert_equal [location], proposal.locations |
125 | end | 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 | end | 127 | end |