I have a classification function, which determines if a paragraph of text belongs to a category (i.e. it returns true/false). I have an array of real world examples, and I do not expect it classify correctly 100% of the time.
def meal?(text)
!text.match(/restaurant|meal|wine|.../i).nil?
end
Can RSPEC specify a test that, when I feed these hundreds of examples to that function, as long as 90% are identified correctly, then it counts as a pass? Even better would be to have RSPEC output examples that fails in the report. If it is possible how can one write such a test?
Sure.
Anything you can compare, or reduce to a boolean expression, RSpec can handle…which is pretty much everything in software. It’s just a matter of figuring out how to express it.