Sha256: c89d93ea4b90748edad6080926405dc2fdd87a1de2c5c261aececb4f3221939b

Contents?: true

Size: 1009 Bytes

Versions: 2

Compression:

Stored size: 1009 Bytes

Contents

require_relative '../test_helper'
require_relative '../../lib/signore/mapper'
require_relative '../../lib/signore/signature'

module Signore
  describe Mapper do
    let(:sig_hash) do
      {
        'author'  => 'Anonymous Coward',
        'source'  => '/.',
        'subject' => 'on ‘Monty Wants to Save MySQL’',
        'tags'    => %w(/. MySQL),
        'text'    => text,
      }
    end
    let(:signature) do
      Signature.new(author: 'Anonymous Coward', source: '/.',
                    subject: 'on ‘Monty Wants to Save MySQL’',
                    tags: %w(/. MySQL), text: text)
    end
    let(:text) do
      'For the sake of topic titles, I’d rather if Monty saved Python.'
    end

    describe '.from_h' do
      it 'deserializes a Signature from a Hash' do
        Mapper.from_h(sig_hash).must_equal signature
      end
    end

    describe '.to_h' do
      it 'serialises a Signature to a Hash' do
        Mapper.to_h(signature).must_equal sig_hash
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
signore-0.4.0 test/signore/mapper_test.rb
signore-0.3.3 test/signore/mapper_test.rb