Commit f618532903dcf3fbca76f9e98eeffe375d654dc2

Authored by Leandro Santos
1 parent 7e162ba3

refactoring some tasks controller tests

Showing 1 changed file with 99 additions and 89 deletions   Show diff stats
test/functional/tasks_controller_test.rb
... ... @@ -12,14 +12,14 @@ class TasksControllerTest < ActionController::TestCase
12 12 @request = ActionController::TestRequest.new
13 13 @response = ActionController::TestResponse.new
14 14  
15   - self.profile = create_user('testuser').person
16   - @controller.stubs(:profile).returns(profile)
  15 + @person = create_user('testuser').person
  16 + @controller.stubs(:profile).returns(@person)
17 17 login_as 'testuser'
18 18 end
19   - attr_accessor :profile
  19 + attr_accessor :person
20 20  
21 21 def assert_redirected_to(options)
22   - super({ :controller => 'tasks', :profile => profile.identifier }.merge(options))
  22 + super({ :controller => 'tasks', :profile => person.identifier }.merge(options))
23 23 end
24 24  
25 25 should 'list pending tasks' do
... ... @@ -32,8 +32,8 @@ class TasksControllerTest < ActionController::TestCase
32 32  
33 33 should 'list pending tasks without spam' do
34 34 requestor = fast_create(Person)
35   - task_spam = Task.create!(:requestor => requestor, :target => profile, :spam => true)
36   - task_ham = Task.create!(:requestor => requestor, :target => profile, :spam => false)
  35 + task_spam = Task.create!(:requestor => requestor, :target => person, :spam => true)
  36 + task_ham = Task.create!(:requestor => requestor, :target => person, :spam => false)
37 37  
38 38 get :index
39 39 assert_response :success
... ... @@ -50,15 +50,15 @@ class TasksControllerTest < ActionController::TestCase
50 50 end
51 51  
52 52 should 'display task created_at' do
53   - Task.create!(:requestor => fast_create(Person), :target => profile, :spam => false)
  53 + Task.create!(:requestor => fast_create(Person), :target => person, :spam => false)
54 54 get :index
55 55 assert_select '.task_date'
56 56 end
57 57  
58 58 should 'list processed tasks without spam' do
59 59 requestor = fast_create(Person)
60   - task_spam = create(Task, :status => Task::Status::FINISHED, :requestor => requestor, :target => profile, :spam => true)
61   - task_ham = create(Task, :status => Task::Status::FINISHED, :requestor => requestor, :target => profile, :spam => false)
  60 + task_spam = create(Task, :status => Task::Status::FINISHED, :requestor => requestor, :target => person, :spam => true)
  61 + task_ham = create(Task, :status => Task::Status::FINISHED, :requestor => requestor, :target => person, :spam => false)
62 62  
63 63 get :processed
64 64 assert_response :success
... ... @@ -66,23 +66,8 @@ class TasksControllerTest < ActionController::TestCase
66 66 assert_not_includes assigns(:tasks), task_spam
67 67 end
68 68  
69   - should 'save tasks tags' do
70   -
71   - requestor = fast_create(Person)
72   -
73   - task_one = Task.create!(:requestor => requestor, :target => profile, :data => {:name => 'Task Test'})
74   - task_two = Task.create!(:requestor => requestor, :target => profile, :data => {:name => 'Another Task'})
75   -
76   - post :save_tags, :task_id => task_one.id, :tag_list => 'noosfero,test'
77   - post :save_tags, :task_id => task_two.id, :tag_list => 'test'
78   -
79   - assert_includes task_one.tags_from(nil), 'test'
80   - assert_not_includes task_two.tags_from(nil), 'noosfero'
81   -
82   - end
83   -
84 69 should 'be able to finish a task' do
85   - t = profile.tasks.build; t.save!
  70 + t = person.tasks.build; t.save!
86 71  
87 72 post :close, :tasks => {t.id => {:decision => 'finish', :task => {}}}
88 73 assert_redirected_to :action => 'index'
... ... @@ -92,7 +77,7 @@ class TasksControllerTest < ActionController::TestCase
92 77 end
93 78  
94 79 should 'be able to cancel a task' do
95   - t = profile.tasks.build; t.save!
  80 + t = person.tasks.build; t.save!
96 81  
97 82 post :close, :tasks => {t.id => {:decision => 'cancel', :task => {}}}
98 83 assert_redirected_to :action => 'index'
... ... @@ -102,7 +87,7 @@ class TasksControllerTest < ActionController::TestCase
102 87 end
103 88  
104 89 should 'be able to skip a task' do
105   - t = profile.tasks.build; t.save!
  90 + t = person.tasks.build; t.save!
106 91  
107 92 post :close, :tasks => {t.id => {:decision => 'skip', :task => {}}}
108 93 assert_redirected_to :action => 'index'
... ... @@ -112,9 +97,9 @@ class TasksControllerTest < ActionController::TestCase
112 97 end
113 98  
114 99 should 'be able to apply different decisions to multiples tasks at the same time' do
115   - t1 = profile.tasks.build; t1.save!
116   - t2 = profile.tasks.build; t2.save!
117   - t3 = profile.tasks.build; t3.save!
  100 + t1 = person.tasks.build; t1.save!
  101 + t2 = person.tasks.build; t2.save!
  102 + t3 = person.tasks.build; t3.save!
118 103  
119 104 post :close, :tasks => {t1.id => {:decision => 'finish', :task => {}}, t2.id => {:decision => 'cancel', :task => {}}, t3.id => {:decision => 'skip', :task => {}}}
120 105 assert_redirected_to :action => 'index'
... ... @@ -129,56 +114,60 @@ class TasksControllerTest < ActionController::TestCase
129 114 end
130 115  
131 116 should 'affiliate roles to user after finish add member task' do
132   - t = AddMember.create!(:person => profile, :organization => profile)
133   - count = profile.members.size
  117 + community = fast_create(Community)
  118 + community.add_member(person)
  119 + another_person = fast_create(Person)
  120 + t = AddMember.create!(:person => another_person, :organization => community)
  121 + count = community.members.size
  122 + @controller.stubs(:profile).returns(community)
134 123 post :close, :tasks => {t.id => {:decision => 'finish', :task => {}}}
135   - profile = Profile.find(@profile.id)
136   - assert_equal count + 1, profile.members.size
  124 + community = Profile.find(community.id)
  125 + assert_equal count + 1, community.members.size
137 126 end
138 127  
139 128 should 'display a create ticket form' do
140   - get :new, :profile => profile.identifier
  129 + get :new, :profile => person.identifier
141 130  
142 131 assert_template 'new'
143 132 end
144 133  
145 134 should 'add a hidden field with target_id when informed in the URL' do
146 135 friend = create_user('myfriend').person
147   - profile.add_friend(friend)
  136 + person.add_friend(friend)
148 137  
149   - get :new, :profile => profile.identifier, :target_id => friend.id.to_s
  138 + get :new, :profile => person.identifier, :target_id => friend.id.to_s
150 139  
151 140 assert_tag :tag => 'input', :attributes => { :type => 'hidden', :name => 'ticket[target_id]', :value => friend.id }
152 141 end
153 142  
154 143 should 'select friend from list when not already informed' do
155   - get :new, :profile => profile.identifier
  144 + get :new, :profile => person.identifier
156 145 assert_tag :tag => 'select', :attributes => { :name => 'ticket[target_id]' }
157 146 end
158 147  
159 148 should 'create a ticket' do
160 149 assert_difference 'Ticket.count' do
161   - post :new, :profile => profile.identifier, :ticket => {:name => 'test ticket'}
  150 + post :new, :profile => person.identifier, :ticket => {:name => 'test ticket'}
162 151 end
163 152 end
164 153  
165 154 should 'create a ticket with profile requestor' do
166   - post :new, :profile => profile.identifier, :ticket => {:name => 'new task'}
  155 + post :new, :profile => person.identifier, :ticket => {:name => 'new task'}
167 156  
168   - assert_equal profile, assigns(:ticket).requestor
  157 + assert_equal person, assigns(:ticket).requestor
169 158 end
170 159  
171 160 should 'list tasks that this profile created' do
172   - task = Ticket.create!(:name => 'test', :requestor => profile)
173   - get :list_requested, :profile => profile.identifier
  161 + task = Ticket.create!(:name => 'test', :requestor => person)
  162 + get :list_requested, :profile => person.identifier
174 163  
175 164 assert_includes assigns(:tasks), task
176 165 end
177 166  
178 167 should 'list tasks that this profile created without spam' do
179   - task_spam = Ticket.create!(:name => 'test', :requestor => profile, :spam => true)
180   - task_ham = Ticket.create!(:name => 'test', :requestor => profile, :spam => false)
181   - get :list_requested, :profile => profile.identifier
  168 + task_spam = Ticket.create!(:name => 'test', :requestor => person, :spam => true)
  169 + task_ham = Ticket.create!(:name => 'test', :requestor => person, :spam => false)
  170 + get :list_requested, :profile => person.identifier
182 171  
183 172 assert_includes assigns(:tasks), task_ham
184 173 assert_not_includes assigns(:tasks), task_spam
... ... @@ -186,9 +175,9 @@ class TasksControllerTest < ActionController::TestCase
186 175  
187 176 should 'set target of ticket when creating it' do
188 177 f = create_user('friend').person
189   - profile.add_friend f
  178 + person.add_friend f
190 179  
191   - post :new, :profile => profile.identifier, :ticket => {:name => 'test ticket', :target_id => f.id, :target_type => 'Profile'}
  180 + post :new, :profile => person.identifier, :ticket => {:name => 'test ticket', :target_id => f.id, :target_type => 'Profile'}
192 181 assert_response :redirect
193 182  
194 183 assert_equal f, assigns(:ticket).target
... ... @@ -198,9 +187,9 @@ class TasksControllerTest < ActionController::TestCase
198 187 c = fast_create(Community)
199 188 c.update_attributes(:moderated_articles => false)
200 189 @controller.stubs(:profile).returns(c)
201   - c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id))
202   - article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
203   - t = ApproveArticle.create!(:name => 'test name', :article => article, :target => c, :requestor => profile)
  190 + c.affiliate(person, Profile::Roles.all_roles(person.environment.id))
  191 + article = person.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
  192 + t = ApproveArticle.create!(:name => 'test name', :article => article, :target => c, :requestor => person)
204 193  
205 194 post :close, :tasks => {t.id => {:decision => 'finish', :task => {:name => 'new_name'}}}
206 195 assert_equal article, c.articles.find_by_name('new_name').reference_article
... ... @@ -211,9 +200,9 @@ class TasksControllerTest < ActionController::TestCase
211 200 c.update_attributes(:moderated_articles => false)
212 201 @controller.stubs(:profile).returns(c)
213 202 folder = create(Folder, :profile => c, :name => 'test folder')
214   - c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id))
215   - article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
216   - t = ApproveArticle.create!(:name => 'test name', :article => article, :target => c, :requestor => profile)
  203 + c.affiliate(person, Profile::Roles.all_roles(person.environment.id))
  204 + article = person.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
  205 + t = ApproveArticle.create!(:name => 'test name', :article => article, :target => c, :requestor => person)
217 206  
218 207 post :close, :tasks => {t.id => {:decision => 'finish', :task => {:name => 'new_name', :article_parent_id => folder.id}}}
219 208 assert_equal folder, c.articles.find_by_name('new_name').parent
... ... @@ -224,9 +213,9 @@ class TasksControllerTest < ActionController::TestCase
224 213 c.update_attributes(:moderated_articles => false)
225 214 @controller.stubs(:profile).returns(c)
226 215 folder = create(Article, :profile => c, :name => 'test folder', :type => 'Folder')
227   - c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id))
228   - article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
229   - t = ApproveArticle.create!(:article => article, :target => c, :requestor => profile)
  216 + c.affiliate(person, Profile::Roles.all_roles(person.environment.id))
  217 + article = person.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
  218 + t = ApproveArticle.create!(:article => article, :target => c, :requestor => person)
230 219  
231 220 post :close, :tasks => {t.id => {:decision => 'finish', :task => {:name => 'new_name', :article_parent_id => folder.id, :highlighted => true}}}
232 221 assert_equal true, c.articles.find_by_name('new_name').highlighted
... ... @@ -236,9 +225,9 @@ class TasksControllerTest < ActionController::TestCase
236 225 c = fast_create(Community)
237 226 c.update_attributes(:moderated_articles => false)
238 227 @controller.stubs(:profile).returns(c)
239   - c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id))
240   - article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
241   - t = ApproveArticle.create!(:article => article, :target => c, :requestor => profile)
  228 + c.affiliate(person, Profile::Roles.all_roles(person.environment.id))
  229 + article = person.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
  230 + t = ApproveArticle.create!(:article => article, :target => c, :requestor => person)
242 231  
243 232 post :close, :tasks => {t.id => {:decision => 'finish', :task => {:name => 'new_name', :article_parent_id => ""}}}
244 233 assert_not_nil c.articles.find_by_name('new_name')
... ... @@ -247,7 +236,7 @@ class TasksControllerTest < ActionController::TestCase
247 236 should 'handle blank names for published articles' do
248 237 c = fast_create(Community)
249 238 @controller.stubs(:profile).returns(c)
250   - c.affiliate(profile, Profile::Roles.all_roles(c.environment))
  239 + c.affiliate(person, Profile::Roles.all_roles(c.environment))
251 240 person = create_user('test_user').person
252 241 p_blog = Blog.create!(:profile => person, :name => 'Blog')
253 242 c_blog1 = Blog.create!(:profile => c, :name => 'Blog')
... ... @@ -266,8 +255,8 @@ class TasksControllerTest < ActionController::TestCase
266 255  
267 256 should 'display error if there is an enterprise with the same identifier and keep the task active' do
268 257 e = Environment.default
269   - e.add_admin(profile)
270   - task = CreateEnterprise.create!(:name => "My Enterprise", :identifier => "my-enterprise", :requestor => profile, :target => e)
  258 + e.add_admin(person)
  259 + task = CreateEnterprise.create!(:name => "My Enterprise", :identifier => "my-enterprise", :requestor => person, :target => e)
271 260 enterprise = fast_create(Enterprise, :name => "My Enterprise", :identifier => "my-enterprise")
272 261  
273 262 assert_nothing_raised do
... ... @@ -283,7 +272,7 @@ class TasksControllerTest < ActionController::TestCase
283 272 should 'render TinyMce Editor when approving suggested article task' do
284 273 Task.destroy_all
285 274 c = fast_create(Community)
286   - c.add_admin profile
  275 + c.add_admin person
287 276 @controller.stubs(:profile).returns(c)
288 277 t = SuggestArticle.create!(:article => {:name => 'test name', :abstract => 'test abstract', :body => 'test body'}, :name => 'some name', :email => 'test@localhost.com', :target => c)
289 278  
... ... @@ -295,7 +284,7 @@ class TasksControllerTest < ActionController::TestCase
295 284 should 'create TinyMceArticle article after finish approve suggested article task' do
296 285 TinyMceArticle.destroy_all
297 286 c = fast_create(Community)
298   - c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id))
  287 + c.affiliate(person, Profile::Roles.all_roles(person.environment.id))
299 288 @controller.stubs(:profile).returns(c)
300 289 t = SuggestArticle.create!(:article => {:name => 'test name', :body => 'test body'}, :name => 'some name', :email => 'test@localhost.com', :target => c)
301 290  
... ... @@ -306,7 +295,7 @@ class TasksControllerTest < ActionController::TestCase
306 295 should "change the article's attributes on suggested article task approval" do
307 296 TinyMceArticle.destroy_all
308 297 c = fast_create(Community)
309   - c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id))
  298 + c.affiliate(person, Profile::Roles.all_roles(person.environment.id))
310 299 @controller.stubs(:profile).returns(c)
311 300 t = SuggestArticle.new
312 301 t.article = {:name => 'test name', :body => 'test body', :source => 'http://test.com', :source_name => 'some source name'}
... ... @@ -326,7 +315,7 @@ class TasksControllerTest < ActionController::TestCase
326 315 should "display name from article suggestion when requestor was not setted" do
327 316 Task.destroy_all
328 317 c = fast_create(Community)
329   - c.add_admin profile
  318 + c.add_admin person
330 319 @controller.stubs(:profile).returns(c)
331 320 t = SuggestArticle.create!(:article => {:name => 'test name', :abstract => 'test abstract', :body => 'test body'}, :name => 'some name', :email => 'test@localhost.com', :target => c)
332 321  
... ... @@ -337,7 +326,7 @@ class TasksControllerTest < ActionController::TestCase
337 326 should "append hidden tag with type value from article suggestion" do
338 327 Task.destroy_all
339 328 c = fast_create(Community)
340   - c.add_admin profile
  329 + c.add_admin person
341 330 @controller.stubs(:profile).returns(c)
342 331 t = SuggestArticle.create!(:article => {:name => 'test name', :abstract => 'test abstract', :body => 'test body', :type => 'TextArticle'}, :name => 'some name', :email => 'test@localhost.com', :target => c)
343 332  
... ... @@ -348,7 +337,7 @@ class TasksControllerTest < ActionController::TestCase
348 337 should "display parent_id selection from article suggestion with predefined value" do
349 338 Task.destroy_all
350 339 c = fast_create(Community)
351   - c.add_admin profile
  340 + c.add_admin person
352 341 @controller.stubs(:profile).returns(c)
353 342 parent = fast_create(Folder, :profile_id => c.id)
354 343 t = SuggestArticle.create!(:article => {:name => 'test name', :abstract => 'test abstract', :body => 'test body', :parent_id => parent.id}, :name => 'some name', :email => 'test@localhost.com', :target => c)
... ... @@ -360,7 +349,7 @@ class TasksControllerTest < ActionController::TestCase
360 349 should "not display name from article suggestion when requestor was setted" do
361 350 Task.destroy_all
362 351 c = fast_create(Community)
363   - c.add_admin profile
  352 + c.add_admin person
364 353 @controller.stubs(:profile).returns(c)
365 354 t = SuggestArticle.create!(:article => {:name => 'test name', :abstract => 'test abstract', :body => 'test body'}, :requestor => fast_create(Person), :target => c)
366 355  
... ... @@ -376,7 +365,7 @@ class TasksControllerTest < ActionController::TestCase
376 365  
377 366 should 'close create enterprise if trying to cancel even if there is already an existing identifier' do
378 367 identifier = "common-identifier"
379   - task = CreateEnterprise.create!(:identifier => identifier, :name => identifier, :requestor => profile, :target => profile)
  368 + task = CreateEnterprise.create!(:identifier => identifier, :name => identifier, :requestor => person, :target => person)
380 369 fast_create(Profile, :identifier => identifier)
381 370  
382 371 assert_nothing_raised do
... ... @@ -392,9 +381,9 @@ class TasksControllerTest < ActionController::TestCase
392 381 class FeedDog < Task; end
393 382 Task.stubs(:per_page).returns(3)
394 383 requestor = fast_create(Person)
395   - t1 = CleanHouse.create!(:requestor => requestor, :target => profile)
396   - t2 = CleanHouse.create!(:requestor => requestor, :target => profile)
397   - t3 = FeedDog.create!(:requestor => requestor, :target => profile)
  384 + t1 = CleanHouse.create!(:requestor => requestor, :target => person)
  385 + t2 = CleanHouse.create!(:requestor => requestor, :target => person)
  386 + t3 = FeedDog.create!(:requestor => requestor, :target => person)
398 387  
399 388 get :index, :filter_type => t1.type
400 389  
... ... @@ -414,9 +403,9 @@ class TasksControllerTest &lt; ActionController::TestCase
414 403 class FeedDog < Task; end
415 404 Task.stubs(:per_page).returns(3)
416 405 requestor = fast_create(Person)
417   - t1 = CleanHouse.create!(:requestor => requestor, :target => profile, :data => {:name => 'Task Test'})
418   - t2 = CleanHouse.create!(:requestor => requestor, :target => profile)
419   - t3 = FeedDog.create!(:requestor => requestor, :target => profile)
  406 + t1 = CleanHouse.create!(:requestor => requestor, :target => person, :data => {:name => 'Task Test'})
  407 + t2 = CleanHouse.create!(:requestor => requestor, :target => person)
  408 + t3 = FeedDog.create!(:requestor => requestor, :target => person)
420 409  
421 410 get :index, :filter_type => t1.type, :filter_text => 'test'
422 411  
... ... @@ -435,11 +424,11 @@ class TasksControllerTest &lt; ActionController::TestCase
435 424  
436 425 requestor = fast_create(Person)
437 426  
438   - task_one = Task.create!(:requestor => requestor, :target => profile, :data => {:name => 'Task Test'})
439   - task_two = Task.create!(:requestor => requestor, :target => profile, :data => {:name => 'Another Task'})
  427 + task_one = Task.create!(:requestor => requestor, :target => person, :data => {:name => 'Task Test'})
  428 + task_two = Task.create!(:requestor => requestor, :target => person, :data => {:name => 'Another Task'})
440 429  
441   - profile.tag(task_one, with: 'noosfero,test', on: :tags)
442   - profile.tag(task_two, with: 'test', on: :tags)
  430 + person.tag(task_one, with: 'noosfero,test', on: :tags)
  431 + person.tag(task_two, with: 'test', on: :tags)
443 432  
444 433 get :index, :filter_tags => 'noosfero'
445 434  
... ... @@ -449,11 +438,11 @@ class TasksControllerTest &lt; ActionController::TestCase
449 438  
450 439 should 'return tasks ordered accordingly and limited by pages' do
451 440 time = Time.now
452   - person = fast_create(Person)
453   - t1 = create(Task, :status => Task::Status::ACTIVE, :target => profile, :requestor => person, :created_at => time)
454   - t2 = create(Task, :status => Task::Status::ACTIVE, :target => profile, :requestor => person, :created_at => time + 1.second)
455   - t3 = create(Task, :status => Task::Status::ACTIVE, :target => profile, :requestor => person, :created_at => time + 2.seconds)
456   - t4 = create(Task, :status => Task::Status::ACTIVE, :target => profile, :requestor => person, :created_at => time + 3.seconds)
  441 + requestor = fast_create(Person)
  442 + t1 = create(Task, :status => Task::Status::ACTIVE, :target => person, :requestor => requestor, :created_at => time)
  443 + t2 = create(Task, :status => Task::Status::ACTIVE, :target => person, :requestor => requestor, :created_at => time + 1.second)
  444 + t3 = create(Task, :status => Task::Status::ACTIVE, :target => person, :requestor => requestor, :created_at => time + 2.seconds)
  445 + t4 = create(Task, :status => Task::Status::ACTIVE, :target => person, :requestor => requestor, :created_at => time + 3.seconds)
457 446  
458 447 Task.stubs(:per_page).returns(2)
459 448  
... ... @@ -469,9 +458,9 @@ class TasksControllerTest &lt; ActionController::TestCase
469 458 Task.stubs(:per_page).returns(3)
470 459 requestor = fast_create(Person)
471 460 responsible = fast_create(Person)
472   - t1 = Task.create!(:requestor => requestor, :target => profile, :responsible => responsible)
473   - t2 = Task.create!(:requestor => requestor, :target => profile, :responsible => responsible)
474   - t3 = Task.create!(:requestor => requestor, :target => profile)
  461 + t1 = Task.create!(:requestor => requestor, :target => person, :responsible => responsible)
  462 + t2 = Task.create!(:requestor => requestor, :target => person, :responsible => responsible)
  463 + t3 = Task.create!(:requestor => requestor, :target => person)
475 464  
476 465 get :index, :filter_responsible => responsible.id
477 466  
... ... @@ -661,4 +650,25 @@ class TasksControllerTest &lt; ActionController::TestCase
661 650 assert_select ".task_responsible .value"
662 651 end
663 652  
  653 + should 'save task tags' do
  654 + requestor = fast_create(Person)
  655 +
  656 + task_one = Task.create!(:requestor => requestor, :target => person, :data => {:name => 'Task Test'})
  657 + post :save_tags, :task_id => task_one.id, :tag_list => 'test'
  658 +
  659 + assert_includes task_one.tags_from(nil), 'test'
  660 + end
  661 +
  662 + should 'tag attribution in one task not affect another' do
  663 + requestor = fast_create(Person)
  664 +
  665 + task_one = Task.create!(:requestor => requestor, :target => person, :data => {:name => 'Task Test'})
  666 + task_two = Task.create!(:requestor => requestor, :target => person, :data => {:name => 'Another Task'})
  667 +
  668 + post :save_tags, :task_id => task_one.id, :tag_list => 'noosfero,test'
  669 + post :save_tags, :task_id => task_two.id, :tag_list => 'test'
  670 +
  671 + assert_not_includes task_two.tags_from(nil), 'noosfero'
  672 + end
  673 +
664 674 end
... ...