Sha256: 4f75f8c9407dd98a8156ca77e12b5ec82ef15b100e0089d36528b9a467401ed8

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

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.6.0 test/signore/mapper_test.rb
signore-0.5.0 test/signore/mapper_test.rb