Commit e6e26d291ed312a36c0a7e501828c837755b8465
Exists in
master
and in
8 other branches
Merge branch 'proposal_task_category' of gitlab.com:noosfero-plugins/proposals_d…
…iscussion into proposal_task_category
Showing
3 changed files
with
35 additions
and
0 deletions
Show diff stats
lib/proposals_discussion_plugin/proposal_task.rb
| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | +require_relative '../test_helper' | |
| 2 | + | |
| 3 | +class TaskCategory < ActiveSupport::TestCase | |
| 4 | + | |
| 5 | + def setup | |
| 6 | + @person = fast_create(Person) | |
| 7 | + @profile = fast_create(Community) | |
| 8 | + @discussion = ProposalsDiscussionPlugin::Discussion.create!(:name => 'discussion', :profile => @person, :name => 'discussion') | |
| 9 | + @proposal = ProposalsDiscussionPlugin::Proposal.create!(:name => 'test', :abstract => 'abstract', :profile => @profile, :parent => @discussion) | |
| 10 | + end | |
| 11 | + | |
| 12 | + attr_reader :person, :profile, :discussion, :proposal | |
| 13 | + | |
| 14 | + should 'add a category to a task' do | |
| 15 | + requestor = fast_create(Person) | |
| 16 | + task_data = { | |
| 17 | + :requestor => requestor, | |
| 18 | + :target => person, | |
| 19 | + :spam => false | |
| 20 | + } | |
| 21 | + | |
| 22 | + task = Task.create!(task_data) | |
| 23 | + | |
| 24 | + category = ProposalsDiscussionPlugin::TaskCategory.create!(name: 'ProposalTest', tasks: [task]) | |
| 25 | + | |
| 26 | + assert_equal task.id, category.tasks[0].id | |
| 27 | + end | |
| 28 | + | |
| 29 | +end | ... | ... |