Commit 53d99492d555a3ee9580dc0ca49a057539b01cb8
Committed by
Victor Costa
1 parent
91598067
Exists in
staging
and in
4 other branches
Added functional test for filter tasks by type and data name
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
test/functional/tasks_controller_test.rb
... | ... | @@ -419,6 +419,28 @@ class TasksControllerTest < ActionController::TestCase |
419 | 419 | assert_includes assigns(:tasks), t3 |
420 | 420 | end |
421 | 421 | |
422 | + should 'filter tasks by type and data content' do | |
423 | + class CleanHouse < Task; end | |
424 | + class FeedDog < Task; end | |
425 | + Task.stubs(:per_page).returns(3) | |
426 | + requestor = fast_create(Person) | |
427 | + t1 = CleanHouse.create!(:requestor => requestor, :target => profile, :data => {:name => 'Task Test'}) | |
428 | + t2 = CleanHouse.create!(:requestor => requestor, :target => profile) | |
429 | + t3 = FeedDog.create!(:requestor => requestor, :target => profile) | |
430 | + | |
431 | + post :index, :filter_type => t1.type, :filter_text => 'test' | |
432 | + | |
433 | + assert_includes assigns(:tasks), t1 | |
434 | + assert_not_includes assigns(:tasks), t2 | |
435 | + assert_not_includes assigns(:tasks), t3 | |
436 | + | |
437 | + post :index | |
438 | + | |
439 | + assert_includes assigns(:tasks), t1 | |
440 | + assert_includes assigns(:tasks), t2 | |
441 | + assert_includes assigns(:tasks), t3 | |
442 | + end | |
443 | + | |
422 | 444 | should 'return tasks ordered accordingly and limited by pages' do |
423 | 445 | time = Time.now |
424 | 446 | person = fast_create(Person) | ... | ... |