Sha256: 064c5eafaf88389950a3984ec2e78f922116a6a39b363938a6b3e4a42d349c6e
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
# encoding: UTF-8 require_relative '../spec_helper' module Signore describe Database do describe '#find' do before do srand @db = Database.new 'spec/fixtures/signatures.yml' end it 'returns a random signature by default' do srand 1981 @db.find.text.must_equal 'Amateur fighter pilot ignores orders, listens to the voices in his head and slaughters thousands.' srand 1979 @db.find.text.must_equal 'stay-at-home executives vs. wallstreet dads' end it 'returns a random signature if the tags are empty' do srand 2009 @db.find(tags: []).text.must_equal '// sometimes I believe compiler ignores all my comments' end it 'returns a random signature based on provided tags' do @db.find(tags: ['programming']).text.must_equal '// sometimes I believe compiler ignores all my comments' @db.find(tags: ['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 @db.find(tags: ['tech'], no_tags: ['programming', 'security']).text.must_equal 'You do have to be mad to work here, but it doesn’t help.' end end describe '#save' do it 'saves the provided signature to disk' do file = Tempfile.new '' db = Database.new file.path sig = Signature.new 'Normaliser Unix c’est comme pasteuriser le camembert.' db << sig file.read.must_equal <<-END.dedent --- signatures: - !ruby/struct:Signore::Signature text: Normaliser Unix c’est comme pasteuriser le camembert. author: !!null source: !!null subject: !!null tags: !!null END end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
signore-0.1.0 | spec/signore/database_spec.rb |