Sha256: df392955367523a6b623deb381007d7e3368ec3ecf0e4da2369a8e8161dac9f1
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require 'stringio' require_relative '../test_helper' require_relative '../../lib/signore/sig_from_stream' module Signore describe SigFromStream do describe '.call' do it 'asks about signature parts' do io = capture_io { SigFromStream.call StringIO.new("\n\n\n\n\n") } _(io.first).must_equal <<~end text? author? subject? source? end end it 'asks about signature parts and returns resulting signature' do input = StringIO.new <<~end You do have to be mad to work here, but it doesn’t help. Gary Barnes asr end sig = nil capture_io { sig = SigFromStream.call input } text = 'You do have to be mad to work here, but it doesn’t help.' _(sig).must_equal Signature.new(author: 'Gary Barnes', source: 'asr', text: text) end it 'handles multi-line signatures' do input = StringIO.new <<~end ‘You’ve got an interesting accent. Subtle. I can’t place it.’ ‘It’s text-to-speech… I was raised by smartphones.’ Patrick Ewing end sig = nil capture_io { sig = SigFromStream.call input } text = <<~end.strip ‘You’ve got an interesting accent. Subtle. I can’t place it.’ ‘It’s text-to-speech… I was raised by smartphones.’ end _(sig).must_equal Signature.new(author: 'Patrick Ewing', text: text) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
signore-0.7.0 | test/signore/sig_from_stream_test.rb |