You can use the scan
method, which returns an array of matches. Then you just check the size of the array:
expect(data.scan(purchase.email).size).to eq(3)
An alternative is this syntax:
expect(data.scan(purchase.email)).to have(3).items
expect(data.scan(purchase.email)).to have_exactly(3).items