signore 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'signature'
4
-
5
- module Signore
6
- module Mapper
7
- module_function
8
-
9
- def from_h(hash)
10
- Signature.new(hash.map { |key, value| [key.to_sym, value] }.to_h)
11
- end
12
-
13
- def to_h(signature)
14
- signature.to_h
15
- end
16
- end
17
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../test_helper'
4
- require_relative '../../lib/signore/mapper'
5
- require_relative '../../lib/signore/signature'
6
-
7
- module Signore
8
- describe Mapper do
9
- let(:sig_hash) do
10
- {
11
- 'author' => 'Anonymous Coward',
12
- 'source' => '/.',
13
- 'subject' => 'on ‘Monty Wants to Save MySQL’',
14
- 'tags' => %w(/. MySQL),
15
- 'text' => text,
16
- }
17
- end
18
- let(:signature) do
19
- Signature.new(author: 'Anonymous Coward', source: '/.',
20
- subject: 'on ‘Monty Wants to Save MySQL’',
21
- tags: %w(/. MySQL), text: text)
22
- end
23
- let(:text) do
24
- 'For the sake of topic titles, I’d rather if Monty saved Python.'
25
- end
26
-
27
- describe '.from_h' do
28
- it 'deserializes a Signature from a Hash' do
29
- _(Mapper.from_h(sig_hash)).must_equal signature
30
- end
31
- end
32
-
33
- describe '.to_h' do
34
- it 'serialises a Signature to a Hash' do
35
- _(Mapper.to_h(signature)).must_equal sig_hash
36
- end
37
- end
38
- end
39
- end