Trying to use the .exactly method, but it does not work here.
expect(data).to include(purchase.email).exactly(3).times
This results in an error:
NoMethodError: undefined method `exactly' for #<RSpec::Matchers::BuiltIn::Include:0x007f85c7e71108> # ./spec/models/csv_generator_spec.rb:34:in `block (4 levels) in <top (required)>' # ./spec/models/csv_generator_spec.rb:18:in `each'
Does anyone know how I will test that a substring appears on a line several times?
source share