signore 0.4.0 → 0.4.1
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -4
- data/Gemfile.lock +18 -15
- data/Rakefile +0 -3
- data/lib/signore/sig_finder.rb +2 -2
- data/lib/signore/signature.rb +4 -0
- data/signore.gemspec +4 -4
- data/test/signore/cli_test.rb +9 -11
- data/test/signore/mapper_test.rb +2 -2
- data/test/signore/repo_test.rb +9 -9
- data/test/signore/settings_test.rb +5 -5
- data/test/signore/sig_finder_test.rb +7 -7
- data/test/signore/sig_from_stream_test.rb +5 -7
- data/test/signore/signature_test.rb +21 -17
- data/test/test_helper.rb +1 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3cb84646a3dd64f8ce090d485e75cf19147c6cb
|
4
|
+
data.tar.gz: e36b8088fa0aad770592d130d64ae107603a09a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a30b7d462d1fe9d194f3d2526ed0beeae1d12cfe129c6aed7b7dd40c723355ea7bafbdf7c31bc0aa8a187ff57de6ef5a4581f6f4e807aff10662fde963c772b
|
7
|
+
data.tar.gz: 6e0b8f5e4c50bbf8518ed696ddbe55b2d1ac9716649dfcf5b769afb44d7708e48eb1afe7ca1a0cf003fe7a86ab9e64a0a08535b3dfabd545ac4668827cc96b4b
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
signore (0.4.
|
4
|
+
signore (0.4.1)
|
5
5
|
lovely_rufus (~> 0.3.0)
|
6
6
|
private_attr (~> 1.1)
|
7
7
|
|
@@ -25,10 +25,10 @@ GEM
|
|
25
25
|
dependor (1.0.1)
|
26
26
|
diff-lcs (1.2.5)
|
27
27
|
equalizer (0.0.11)
|
28
|
-
ffi (1.9.
|
28
|
+
ffi (1.9.10)
|
29
29
|
hitimes (1.2.2)
|
30
30
|
ice_nine (0.11.1)
|
31
|
-
listen (2.10.
|
31
|
+
listen (2.10.1)
|
32
32
|
celluloid (~> 0.16.0)
|
33
33
|
rb-fsevent (>= 0.9.3)
|
34
34
|
rb-inotify (>= 0.9)
|
@@ -36,28 +36,28 @@ GEM
|
|
36
36
|
private_attr (~> 1.0)
|
37
37
|
memoizable (0.4.2)
|
38
38
|
thread_safe (~> 0.3, >= 0.3.1)
|
39
|
-
minitest (5.
|
39
|
+
minitest (5.7.0)
|
40
40
|
minitest-focus (1.1.1)
|
41
41
|
minitest (>= 4, < 6)
|
42
|
-
parser (2.2.2.
|
42
|
+
parser (2.2.2.6)
|
43
43
|
ast (>= 1.1, < 3.0)
|
44
44
|
powerpack (0.1.1)
|
45
45
|
private_attr (1.1.0)
|
46
46
|
procto (0.0.2)
|
47
47
|
rainbow (2.0.0)
|
48
48
|
rake (10.4.2)
|
49
|
-
rb-fsevent (0.9.
|
49
|
+
rb-fsevent (0.9.5)
|
50
50
|
rb-inotify (0.9.5)
|
51
51
|
ffi (>= 0.5.0)
|
52
|
-
reek (
|
53
|
-
parser (~> 2.2)
|
52
|
+
reek (3.0.3)
|
53
|
+
parser (~> 2.2.2.5)
|
54
54
|
rainbow (~> 2.0)
|
55
55
|
unparser (~> 0.2.2)
|
56
56
|
rerun (0.10.0)
|
57
57
|
listen (~> 2.7, >= 2.7.3)
|
58
|
-
rubocop (0.
|
58
|
+
rubocop (0.32.1)
|
59
59
|
astrolabe (~> 1.3)
|
60
|
-
parser (>= 2.2.2.
|
60
|
+
parser (>= 2.2.2.5, < 3.0)
|
61
61
|
powerpack (~> 0.1)
|
62
62
|
rainbow (>= 1.99.1, < 3.0)
|
63
63
|
ruby-progressbar (~> 1.4)
|
@@ -65,13 +65,13 @@ GEM
|
|
65
65
|
thread_safe (0.3.5)
|
66
66
|
timers (4.0.1)
|
67
67
|
hitimes
|
68
|
-
unparser (0.2.
|
68
|
+
unparser (0.2.4)
|
69
69
|
abstract_type (~> 0.0.7)
|
70
70
|
adamantium (~> 0.2.0)
|
71
71
|
concord (~> 0.1.5)
|
72
72
|
diff-lcs (~> 1.2.5)
|
73
73
|
equalizer (~> 0.0.9)
|
74
|
-
parser (~> 2.2.2
|
74
|
+
parser (~> 2.2.2)
|
75
75
|
procto (~> 0.0.2)
|
76
76
|
|
77
77
|
PLATFORMS
|
@@ -79,10 +79,13 @@ PLATFORMS
|
|
79
79
|
|
80
80
|
DEPENDENCIES
|
81
81
|
bogus (~> 0.1.3)
|
82
|
-
minitest (~> 5.
|
82
|
+
minitest (~> 5.6)
|
83
83
|
minitest-focus (~> 1.1)
|
84
84
|
rake (~> 10.1)
|
85
|
-
reek (~>
|
85
|
+
reek (~> 3.0)
|
86
86
|
rerun (~> 0.10.0)
|
87
|
-
rubocop (~> 0.
|
87
|
+
rubocop (~> 0.32.0)
|
88
88
|
signore!
|
89
|
+
|
90
|
+
BUNDLED WITH
|
91
|
+
1.10.5
|
data/Rakefile
CHANGED
data/lib/signore/sig_finder.rb
CHANGED
@@ -6,8 +6,8 @@ module Signore
|
|
6
6
|
module_function
|
7
7
|
|
8
8
|
def find(sigs, random: Random.new, tags: Tags.new)
|
9
|
-
|
10
|
-
|
9
|
+
shuffled = sigs.shuffle(random: random)
|
10
|
+
shuffled.find(-> { Signature.new }) { |sig| tags.match?(sig.tags) }
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/lib/signore/signature.rb
CHANGED
data/signore.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.license = 'AGPL-3.0'
|
8
8
|
gem.name = 'signore'
|
9
9
|
gem.summary = 'signore: an email signature manager/randomiser'
|
10
|
-
gem.version = '0.4.
|
10
|
+
gem.version = '0.4.1'
|
11
11
|
|
12
12
|
gem.files = `git ls-files -z`.split "\0"
|
13
13
|
gem.executables = gem.files.grep(%r{^bin/}).map { |path| File.basename(path) }
|
@@ -17,10 +17,10 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.add_dependency 'private_attr', '~> 1.1'
|
18
18
|
|
19
19
|
gem.add_development_dependency 'bogus', '~> 0.1.3'
|
20
|
-
gem.add_development_dependency 'minitest', '~> 5.
|
20
|
+
gem.add_development_dependency 'minitest', '~> 5.6'
|
21
21
|
gem.add_development_dependency 'minitest-focus', '~> 1.1'
|
22
22
|
gem.add_development_dependency 'rake', '~> 10.1'
|
23
|
-
gem.add_development_dependency 'reek', '~>
|
23
|
+
gem.add_development_dependency 'reek', '~> 3.0'
|
24
24
|
gem.add_development_dependency 'rerun', '~> 0.10.0'
|
25
|
-
gem.add_development_dependency 'rubocop', '~> 0.
|
25
|
+
gem.add_development_dependency 'rubocop', '~> 0.32.0'
|
26
26
|
end
|
data/test/signore/cli_test.rb
CHANGED
@@ -9,15 +9,13 @@ module Signore
|
|
9
9
|
describe CLI do
|
10
10
|
describe '#run' do
|
11
11
|
it 'prints usage if no command is given' do
|
12
|
-
|
13
|
-
|
12
|
+
io = capture_io { _(-> { CLI.new([]).run }).must_raise SystemExit }
|
13
|
+
_(io.last).must_include 'usage: signore prego|pronto [tag, …]'
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'prints usage if a bogus command is given' do
|
17
|
-
|
18
|
-
|
19
|
-
end.last
|
20
|
-
out.must_include 'usage: signore prego|pronto [tag, …]'
|
17
|
+
io = capture_io { _(-> { CLI.new(['foo']).run }).must_raise SystemExit }
|
18
|
+
_(io.last).must_include 'usage: signore prego|pronto [tag, …]'
|
21
19
|
end
|
22
20
|
|
23
21
|
describe 'prego' do
|
@@ -28,13 +26,13 @@ module Signore
|
|
28
26
|
args = %w(prego tech programming)
|
29
27
|
out = capture_io { CLI.new(args, repo: repo).run }.first
|
30
28
|
sig = "// sometimes I believe compiler ignores all my comments\n"
|
31
|
-
out.must_equal sig
|
29
|
+
_(out).must_equal sig
|
32
30
|
end
|
33
31
|
|
34
32
|
it 'prints a signature based on allowed and forbidden tags' do
|
35
33
|
args = %w(prego ~programming tech ~security)
|
36
34
|
out = capture_io { CLI.new(args, repo: repo).run }.first
|
37
|
-
out.must_equal <<-end.dedent
|
35
|
+
_(out).must_equal <<-end.dedent
|
38
36
|
You do have to be mad to work here, but it doesn’t help.
|
39
37
|
[Gary Barnes, asr]
|
40
38
|
end
|
@@ -52,7 +50,7 @@ module Signore
|
|
52
50
|
end
|
53
51
|
args = %w(pronto Wikipedia ADHD)
|
54
52
|
out = capture_io { CLI.new(args, repo: repo).run input: input }.first
|
55
|
-
out.must_equal <<-end.dedent
|
53
|
+
_(out).must_equal <<-end.dedent
|
56
54
|
text?
|
57
55
|
author?
|
58
56
|
subject?
|
@@ -62,7 +60,7 @@ module Signore
|
|
62
60
|
end
|
63
61
|
args = %w(prego Wikipedia ADHD)
|
64
62
|
out = capture_io { CLI.new(args, repo: repo).run }.first
|
65
|
-
out.must_equal <<-end.dedent
|
63
|
+
_(out).must_equal <<-end.dedent
|
66
64
|
The Wikipedia page on ADHD is like 20 pages long. That’s just cruel.
|
67
65
|
[Mark Pilgrim]
|
68
66
|
end
|
@@ -76,7 +74,7 @@ module Signore
|
|
76
74
|
Patrick Ewing\n\n\n
|
77
75
|
end
|
78
76
|
io = capture_io { CLI.new(['pronto'], repo: repo).run input: input }
|
79
|
-
io.first.must_equal <<-end.dedent
|
77
|
+
_(io.first).must_equal <<-end.dedent
|
80
78
|
text?
|
81
79
|
author?
|
82
80
|
subject?
|
data/test/signore/mapper_test.rb
CHANGED
@@ -24,13 +24,13 @@ module Signore
|
|
24
24
|
|
25
25
|
describe '.from_h' do
|
26
26
|
it 'deserializes a Signature from a Hash' do
|
27
|
-
Mapper.from_h(sig_hash).must_equal signature
|
27
|
+
_(Mapper.from_h(sig_hash)).must_equal signature
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '.to_h' do
|
32
32
|
it 'serialises a Signature to a Hash' do
|
33
|
-
Mapper.to_h(signature).must_equal sig_hash
|
33
|
+
_(Mapper.to_h(signature)).must_equal sig_hash
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/test/signore/repo_test.rb
CHANGED
@@ -16,13 +16,13 @@ module Signore
|
|
16
16
|
|
17
17
|
it 'saves the provided signature to disk' do
|
18
18
|
Repo.new(path: path) << sig
|
19
|
-
path.read.must_include text
|
19
|
+
_(path.read).must_include text
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'rewrites legacy YAML files on save' do
|
23
23
|
FileUtils.cp Pathname.new('test/fixtures/signatures.legacy.yml'), path
|
24
24
|
Repo.new(path: path) << sig
|
25
|
-
path.read.wont_include 'Signore::Signature'
|
25
|
+
_(path.read).wont_include 'Signore::Signature'
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -35,20 +35,20 @@ module Signore
|
|
35
35
|
|
36
36
|
it 'returns a random signature by default' do
|
37
37
|
stub(sig_finder).find(sigs, tags: Tags.new) { sigs.last }
|
38
|
-
repo.find.must_equal sigs.last
|
38
|
+
_(repo.find).must_equal sigs.last
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'returns a random signature based on required and forbidden tags' do
|
42
42
|
tags = Tags.new(forbidden: %w(tech), required: %w(programming security))
|
43
43
|
stub(sig_finder).find(sigs, tags: tags) { sigs.last }
|
44
|
-
repo.find(tags: tags).must_equal sigs.last
|
44
|
+
_(repo.find(tags: tags)).must_equal sigs.last
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'doesn’t blow up if the path is missing' do
|
48
48
|
begin
|
49
49
|
tempdir = Dir.mktmpdir
|
50
50
|
path = Pathname.new("#{tempdir}/some_intermediate_dir/sigs.yml")
|
51
|
-
Repo.new(path: path).find(tags: Tags.new).must_equal Signature.new
|
51
|
+
_(Repo.new(path: path).find(tags: Tags.new)).must_equal Signature.new
|
52
52
|
ensure
|
53
53
|
FileUtils.rmtree tempdir
|
54
54
|
end
|
@@ -58,7 +58,7 @@ module Signore
|
|
58
58
|
path = Pathname.new('test/fixtures/signatures.legacy.yml')
|
59
59
|
repo = Repo.new(path: path, sig_finder: sig_finder)
|
60
60
|
stub(sig_finder).find(sigs, tags: Tags.new) { sigs.last }
|
61
|
-
repo.find.must_equal sigs.last
|
61
|
+
_(repo.find).must_equal sigs.last
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -66,9 +66,9 @@ module Signore
|
|
66
66
|
it 'returns all the Signatures from the Repo' do
|
67
67
|
path = Pathname.new('test/fixtures/signatures.yml')
|
68
68
|
sigs = Repo.new(path: path).sigs
|
69
|
-
sigs.size.must_equal 6
|
70
|
-
sigs.first.author.must_equal 'Clive James'
|
71
|
-
sigs.last.subject.must_equal 'Star Wars ending explained'
|
69
|
+
_(sigs.size).must_equal 6
|
70
|
+
_(sigs.first.author).must_equal 'Clive James'
|
71
|
+
_(sigs.last.subject).must_equal 'Star Wars ending explained'
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -8,7 +8,7 @@ module Signore
|
|
8
8
|
describe Settings do
|
9
9
|
describe '#action' do
|
10
10
|
it 'is defined by the first argument' do
|
11
|
-
Settings.new(['prego']).action.must_equal 'prego'
|
11
|
+
_(Settings.new(['prego']).action).must_equal 'prego'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -18,7 +18,7 @@ module Signore
|
|
18
18
|
old_xdg = ENV.delete('XDG_DATA_HOME')
|
19
19
|
ENV['XDG_DATA_HOME'] = Dir.mktmpdir
|
20
20
|
path = "#{ENV['XDG_DATA_HOME']}/signore/signatures.yml"
|
21
|
-
Settings.new.repo_path.must_equal Pathname.new(path)
|
21
|
+
_(Settings.new.repo_path).must_equal Pathname.new(path)
|
22
22
|
ensure
|
23
23
|
FileUtils.rmtree ENV['XDG_DATA_HOME']
|
24
24
|
old_xdg ? ENV['XDG_DATA_HOME'] = old_xdg : ENV.delete('XDG_DATA_HOME')
|
@@ -29,7 +29,7 @@ module Signore
|
|
29
29
|
begin
|
30
30
|
old_xdg = ENV.delete('XDG_DATA_HOME')
|
31
31
|
path = File.expand_path('~/.local/share/signore/signatures.yml')
|
32
|
-
Settings.new.repo_path.must_equal Pathname.new(path)
|
32
|
+
_(Settings.new.repo_path).must_equal Pathname.new(path)
|
33
33
|
ensure
|
34
34
|
ENV['XDG_DATA_HOME'] = old_xdg if old_xdg
|
35
35
|
end
|
@@ -39,11 +39,11 @@ module Signore
|
|
39
39
|
describe '#tags' do
|
40
40
|
it 'returns the forbidden and required tags' do
|
41
41
|
tags = Tags.new(forbidden: %w(tech), required: %w(en))
|
42
|
-
Settings.new(%w(prego ~tech en)).tags.must_equal tags
|
42
|
+
_(Settings.new(%w(prego ~tech en)).tags).must_equal tags
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'doesn’t blow up on empty args' do
|
46
|
-
Settings.new([]).tags.must_equal Tags.new
|
46
|
+
_(Settings.new([]).tags).must_equal Tags.new
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -13,32 +13,32 @@ module Signore
|
|
13
13
|
|
14
14
|
describe '.find' do
|
15
15
|
it 'returns a random Signature by default' do
|
16
|
-
SigFinder.find(sigs, random: Random.new(0)).text
|
16
|
+
_(SigFinder.find(sigs, random: Random.new(0)).text)
|
17
17
|
.must_include 'Amateur fighter pilot ignores orders'
|
18
|
-
SigFinder.find(sigs, random: Random.new(1)).text
|
18
|
+
_(SigFinder.find(sigs, random: Random.new(1)).text)
|
19
19
|
.must_equal '// sometimes I believe compiler ignores all my comments'
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'returns a random signature if the tags are empty' do
|
23
|
-
SigFinder.find(sigs, tags: Tags.new, random: Random.new(1)).text
|
23
|
+
_(SigFinder.find(sigs, tags: Tags.new, random: Random.new(1)).text)
|
24
24
|
.must_equal '// sometimes I believe compiler ignores all my comments'
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'returns a random signature based on provided tags' do
|
28
|
-
SigFinder.find(sigs, tags: Tags.new(required: %w(programming))).text
|
28
|
+
_(SigFinder.find(sigs, tags: Tags.new(required: %w(programming))).text)
|
29
29
|
.must_equal '// sometimes I believe compiler ignores all my comments'
|
30
|
-
SigFinder.find(sigs, tags: Tags.new(required: %w(work))).text
|
30
|
+
_(SigFinder.find(sigs, tags: Tags.new(required: %w(work))).text)
|
31
31
|
.must_equal 'You do have to be mad to work here, but it doesn’t help.'
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'returns a random signature based on required and forbidden tags' do
|
35
35
|
tags = Tags.new(forbidden: %w(programming security), required: %w(tech))
|
36
|
-
SigFinder.find(sigs, tags: tags).text
|
36
|
+
_(SigFinder.find(sigs, tags: tags).text)
|
37
37
|
.must_equal 'You do have to be mad to work here, but it doesn’t help.'
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'returns a null object if there are no results' do
|
41
|
-
SigFinder.find([]).must_equal Signature.new
|
41
|
+
_(SigFinder.find([])).must_equal Signature.new
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -6,10 +6,8 @@ module Signore
|
|
6
6
|
describe SigFromStream do
|
7
7
|
describe '.sig_from' do
|
8
8
|
it 'asks about signature parts' do
|
9
|
-
|
10
|
-
|
11
|
-
SigFromStream.sig_from input
|
12
|
-
end.first.must_equal <<-end.dedent
|
9
|
+
io = capture_io { SigFromStream.sig_from StringIO.new("\n\n\n\n") }
|
10
|
+
_(io.first).must_equal <<-end.dedent
|
13
11
|
text?
|
14
12
|
author?
|
15
13
|
subject?
|
@@ -30,8 +28,8 @@ module Signore
|
|
30
28
|
sig = nil
|
31
29
|
capture_io { sig = SigFromStream.sig_from input }
|
32
30
|
text = 'You do have to be mad to work here, but it doesn’t help.'
|
33
|
-
sig.must_equal Signature.new(author: 'Gary Barnes', source: 'asr',
|
34
|
-
|
31
|
+
_(sig).must_equal Signature.new(author: 'Gary Barnes', source: 'asr',
|
32
|
+
text: text)
|
35
33
|
end
|
36
34
|
|
37
35
|
it 'handles multi-line signatures' do
|
@@ -48,7 +46,7 @@ module Signore
|
|
48
46
|
‘You’ve got an interesting accent. Subtle. I can’t place it.’
|
49
47
|
‘It’s text-to-speech… I was raised by smartphones.’
|
50
48
|
end
|
51
|
-
sig.must_equal Signature.new(author: 'Patrick Ewing', text: text)
|
49
|
+
_(sig).must_equal Signature.new(author: 'Patrick Ewing', text: text)
|
52
50
|
end
|
53
51
|
end
|
54
52
|
end
|
@@ -12,18 +12,18 @@ module Signore
|
|
12
12
|
sig = Signature.new(author: 'Paul E. Ceruzzi', source: source,
|
13
13
|
subject: 'on Wallace Eckert',
|
14
14
|
tags: ['punched cards'], text: text)
|
15
|
-
sig.author.must_equal 'Paul E. Ceruzzi'
|
16
|
-
sig.source.must_equal source
|
17
|
-
sig.subject.must_equal 'on Wallace Eckert'
|
18
|
-
sig.tags.must_equal ['punched cards']
|
19
|
-
sig.text.must_equal text
|
15
|
+
_(sig.author).must_equal 'Paul E. Ceruzzi'
|
16
|
+
_(sig.source).must_equal source
|
17
|
+
_(sig.subject).must_equal 'on Wallace Eckert'
|
18
|
+
_(sig.tags).must_equal ['punched cards']
|
19
|
+
_(sig.text).must_equal text
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'nils empty parameters' do
|
23
23
|
new = Signature.new(author: '', source: '', subject: '', tags: [],
|
24
24
|
text: '')
|
25
|
-
new.must_equal Signature.new(author: nil, source: nil, subject: nil,
|
26
|
-
|
25
|
+
_(new).must_equal Signature.new(author: nil, source: nil, subject: nil,
|
26
|
+
tags: nil, text: nil)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -33,9 +33,9 @@ module Signore
|
|
33
33
|
sig = Signature.new(author: 'Anonymous Coward', source: '/.',
|
34
34
|
subject: 'on ‘Monty Wants to Save MySQL’',
|
35
35
|
tags: %w(/. MySQL), text: text)
|
36
|
-
sig.to_h.must_equal 'author' => 'Anonymous Coward', 'source' => '/.',
|
37
|
-
|
38
|
-
|
36
|
+
_(sig.to_h).must_equal 'author' => 'Anonymous Coward', 'source' => '/.',
|
37
|
+
'subject' => 'on ‘Monty Wants to Save MySQL’',
|
38
|
+
'tags' => %w(/. MySQL), 'text' => text
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'removes non-existing keys' do
|
@@ -44,16 +44,20 @@ module Signore
|
|
44
44
|
end
|
45
45
|
|
46
46
|
describe '#to_s' do
|
47
|
+
it 'is an empty String for an empty Signature' do
|
48
|
+
_(Signature.new.to_s).must_equal ''
|
49
|
+
end
|
50
|
+
|
47
51
|
it 'does not show meta if there’s nothing to show' do
|
48
52
|
text = '// sometimes I believe compiler ignores all my comments'
|
49
53
|
sig = Signature.new(text: text)
|
50
|
-
sig.to_s.must_equal text
|
54
|
+
_(sig.to_s).must_equal text
|
51
55
|
end
|
52
56
|
|
53
57
|
it 'shows author on its own' do
|
54
58
|
sig = Signature.new(author: 'kodz',
|
55
59
|
text: 'stay-at-home executives vs. wallstreet dads')
|
56
|
-
sig.to_s.must_equal <<-end.dedent.strip
|
60
|
+
_(sig.to_s).must_equal <<-end.dedent.strip
|
57
61
|
stay-at-home executives vs. wallstreet dads
|
58
62
|
[kodz]
|
59
63
|
end
|
@@ -62,7 +66,7 @@ module Signore
|
|
62
66
|
it 'shows author and source, comma-separated' do
|
63
67
|
text = 'You do have to be mad to work here, but it doesn’t help.'
|
64
68
|
sig = Signature.new(author: 'Gary Barnes', source: 'asr', text: text)
|
65
|
-
sig.to_s.must_equal <<-end.dedent.strip
|
69
|
+
_(sig.to_s).must_equal <<-end.dedent.strip
|
66
70
|
You do have to be mad to work here, but it doesn’t help.
|
67
71
|
[Gary Barnes, asr]
|
68
72
|
end
|
@@ -71,7 +75,7 @@ module Signore
|
|
71
75
|
it 'shows source on its own' do
|
72
76
|
text = 'Bruce Schneier knows Alice and Bob’s shared secret.'
|
73
77
|
sig = Signature.new(source: 'Bruce Schneier Facts', text: text)
|
74
|
-
sig.to_s.must_equal <<-end.dedent.strip
|
78
|
+
_(sig.to_s).must_equal <<-end.dedent.strip
|
75
79
|
Bruce Schneier knows Alice and Bob’s shared secret.
|
76
80
|
[Bruce Schneier Facts]
|
77
81
|
end
|
@@ -82,7 +86,7 @@ module Signore
|
|
82
86
|
'in the same way a midget is good at being short.'
|
83
87
|
sig = Signature.new(author: 'Clive James', subject: 'on Marilyn Monroe',
|
84
88
|
text: text)
|
85
|
-
sig.to_s.must_equal <<-end.dedent.strip
|
89
|
+
_(sig.to_s).must_equal <<-end.dedent.strip
|
86
90
|
She was good at playing abstract confusion in
|
87
91
|
the same way a midget is good at being short.
|
88
92
|
[Clive James on Marilyn Monroe]
|
@@ -93,7 +97,7 @@ module Signore
|
|
93
97
|
text = 'Amateur fighter pilot ignores orders, listens ' \
|
94
98
|
'to the voices in his head and slaughters thousands.'
|
95
99
|
sig = Signature.new(subject: 'Star Wars ending explained', text: text)
|
96
|
-
sig.to_s.must_equal <<-end.dedent.strip
|
100
|
+
_(sig.to_s).must_equal <<-end.dedent.strip
|
97
101
|
Amateur fighter pilot ignores orders, listens to
|
98
102
|
the voices in his head and slaughters thousands.
|
99
103
|
[Star Wars ending explained]
|
@@ -102,7 +106,7 @@ module Signore
|
|
102
106
|
|
103
107
|
it 'handles edge cases properly' do
|
104
108
|
YAML.load_file('test/fixtures/wrapper.yml').each do |sig, wrapped|
|
105
|
-
sig.to_s.must_equal wrapped
|
109
|
+
_(sig.to_s).must_equal wrapped
|
106
110
|
end
|
107
111
|
end
|
108
112
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Szotkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lovely_rufus
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '5.
|
61
|
+
version: '5.6'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '5.
|
68
|
+
version: '5.6'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest-focus
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '3.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '3.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rerun
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.32.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
138
|
+
version: 0.32.0
|
139
139
|
description: signore helps manage email signatures and select random ones based on
|
140
140
|
their tags
|
141
141
|
email: chastell@chastell.net
|