Sha256: cbe67c62c145017cc3c14e9b5b056043e9f5afe567b049f571d8fd166864ac0b
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
require 'recog/db' describe Recog::DB do Dir[File.expand_path File.join('xml', '*.xml')].each do |xml_file_name| describe "##{File.basename(xml_file_name)}" do db = Recog::DB.new(xml_file_name) it "has a match key" do expect(db.match_key).not_to be_nil expect(db.match_key).not_to be_empty end db.fingerprints.each do |fp| context "#{fp.regex}" do if fp.name.nil? || fp.name.empty? skip "has a name" end # Not yet enforced # it "has a name" do # expect(fp.name).not_to be_nil # expect(fp.name).not_to be_empty # end it "has a regex" do expect(fp.regex).not_to be_nil expect(fp.regex.class).to be ::Regexp end # Not yet enforced # it "has test cases" do # expect(fp.tests.length).not_to equal(0) # end fp.tests.each do |example| it "passes self-test #{example.content.gsub(/\s+/, ' ')[0,32]}..." do match = fp.match(example.content) expect(match).to_not be_nil # test any extractions specified in the example example.attributes.each_pair do |k,v| expect(match[k]).to eq(v) end end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
recog-1.0.1 | spec/lib/fingerprint_self_test_spec.rb |