Sha256: 79611b77ba2064d5957d0f42fb5df025c24a823858fde8f1be314dd47c93feda
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
require 'yaml/store' require_relative '../test_helper' require_relative '../../lib/signore/sig_finder' require_relative '../../lib/signore/signature' require_relative '../../lib/signore/tags' module Signore describe SigFinder do verify_contract SigFinder let(:sigs) do Repo.new(path: Pathname.new('test/fixtures/signatures.yml')).sigs end describe '#find' do it 'returns a random Signature by default' do _(SigFinder.find(sigs, random: Random.new(0)).text) .must_include 'Amateur fighter pilot ignores orders' _(SigFinder.find(sigs, random: Random.new(1)).text) .must_equal '// sometimes I believe compiler ignores all my comments' end it 'returns a random signature if the tags are empty' do _(SigFinder.find(sigs, random: Random.new(0), tags: Tags.new).text) .must_include 'Amateur fighter pilot ignores orders' end it 'returns a random signature based on provided tags' do _(SigFinder.find(sigs, tags: Tags.new(required: %w[programming])).text) .must_equal '// sometimes I believe compiler ignores all my comments' _(SigFinder.find(sigs, tags: Tags.new(required: %w[work])).text) .must_equal 'You do have to be mad to work here, but it doesn’t help.' end it 'returns a random signature based on required and forbidden tags' do tags = Tags.new(forbidden: %w[programming security], required: %w[tech]) _(SigFinder.find(sigs, tags: tags).text) .must_equal 'You do have to be mad to work here, but it doesn’t help.' end it 'returns a null object if there are no results' do _(SigFinder.find([])).must_equal Signature.new end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
signore-0.7.0 | test/signore/sig_finder_test.rb |