Sha256: 8eed1f8c38510798c473369102d76355c75febc3cb49a45d6d273105dca511f5

Contents?: true

Size: 1009 Bytes

Versions: 3

Compression:

Stored size: 1009 Bytes

Contents

require_relative '../spec_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

3 entries across 3 versions & 1 rubygems

Version Path
signore-0.3.2 spec/signore/mapper_spec.rb
signore-0.3.1 spec/signore/mapper_spec.rb
signore-0.3.0 spec/signore/mapper_spec.rb