diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index 63dd36a..bff4dff 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -419,6 +419,28 @@ class TasksControllerTest < ActionController::TestCase assert_includes assigns(:tasks), t3 end + should 'filter tasks by type and data content' do + class CleanHouse < Task; end + class FeedDog < Task; end + Task.stubs(:per_page).returns(3) + requestor = fast_create(Person) + t1 = CleanHouse.create!(:requestor => requestor, :target => profile, :data => {:name => 'Task Test'}) + t2 = CleanHouse.create!(:requestor => requestor, :target => profile) + t3 = FeedDog.create!(:requestor => requestor, :target => profile) + + post :index, :filter_type => t1.type, :filter_text => 'test' + + assert_includes assigns(:tasks), t1 + assert_not_includes assigns(:tasks), t2 + assert_not_includes assigns(:tasks), t3 + + post :index + + assert_includes assigns(:tasks), t1 + assert_includes assigns(:tasks), t2 + assert_includes assigns(:tasks), t3 + end + should 'return tasks ordered accordingly and limited by pages' do time = Time.now person = fast_create(Person) -- libgit2 0.21.2