Skip to content

Instantly share code, notes, and snippets.

@jzajpt
Created March 31, 2021 12:08
Show Gist options
  • Save jzajpt/36abbc54ff2c9ae7da7a2921814085ec to your computer and use it in GitHub Desktop.
Save jzajpt/36abbc54ff2c9ae7da7a2921814085ec to your computer and use it in GitHub Desktop.
should "return only matched non-duplicated clients" do
create_list :client, 2
rob_rogers = create :client, full_name: "Rob Rogers"
rob_holmes = create :client, full_name: "Rob Holmes"
suspended_client = create :client, :cancelled
create(:score_tracker, client: rob_rogers)
3.times { create(:followup_callback, client: rob_holmes) }
4.times { create(:followup_callback, client: suspended_client) }
clients = Clients::FilterClients.run!(search_query: "Rob")
assert_same_elements [
rob_rogers.id, rob_holmes.id
], clients.pluck(:id)
assert_equal 2, clients.size
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment