```ruby
require "spec_helper"

describe "Contacts" do
  include Public::ContactSteps

  let!(:contact) { create(:phone_number).contact }
  let!(:contact2) { create(:phone_number).contact }

  before { Department.first.contacts.count.should eq(2) }
  before { ensure_on contacts_path(Department.first) }

  context "list" do
    it { verify contacts_exist([contact, contact2]) }
  end

  context "filter", js: true do
    before { fill_in "Contains", with: contact.title } # filter

    it { verify contacts_exist([contact]) }
    it { expect(page).to_not have_content(contact2.title) }
  end
end
```

Extend the contacts filtering specs to include filter by topic
user
```ruby
require "spec_helper"

describe "Contacts" do
  include Public::ContactSteps

  let!(:contact) { create(:contact, :with_phone_numbers, :with_contact_group) }
  let!(:contact2) { create(:contact, :with_phone_numbers, :with_contact_group) }

  before { ensure_on contacts_path(Department.first) }

  context "list" do
    it { verify contacts_exist([contact, contact2]) }
  end

  context "filter", js: true do
    context "by title" do
      before { fill_in "Contains", with: contact.title }

      it { verify contacts_exist([contact]) }
      it { expect(page).to_not have_content(contact2.title) }
    end
    context "by topic" do
      before { select contact.contact_groups.first, from: "Topic" }

      it { verify contacts_exist([contact]) }
      it { expect(page).to_not have_content(contact2.title) }
    end
    context "by both title and topic" do
      before { 
        fill_in "Contains", with: contact.title
        select contact.contact_groups.first, from: "Topic"
      }

      it { verify contacts_exist([contact]) }
      it { expect(page).to_not have_content(contact2.title) }
    end
  end
end
```
assistant