lovely_rufus 0.3.1 → 0.3.2
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/{config/reek.yml → .reek} +0 -8
- data/.travis.yml +6 -0
- data/Gemfile.lock +28 -25
- data/Rakefile +0 -1
- data/lib/lovely_rufus.rb +1 -3
- data/lib/lovely_rufus/text_wrapper.rb +1 -1
- data/lovely_rufus.gemspec +9 -7
- data/test/lovely_rufus/cli_wrapper_test.rb +3 -3
- data/test/lovely_rufus/layers/basic_wrapper_test.rb +5 -4
- data/test/lovely_rufus/layers/code_comment_stripper_test.rb +3 -3
- data/test/lovely_rufus/layers/email_quote_stripper_test.rb +4 -4
- data/test/lovely_rufus/layers/hangout_wrapper_test.rb +3 -3
- data/test/lovely_rufus/layers/one_letter_gluer_test.rb +3 -3
- data/test/lovely_rufus/settings_test.rb +3 -3
- data/test/lovely_rufus/text_wrapper_test.rb +6 -6
- data/test/lovely_rufus/wrap_test.rb +7 -7
- data/test/lovely_rufus_test.rb +2 -2
- data/test/test_helper.rb +2 -2
- metadata +16 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f88c371b8cb6103dd742cdd5d5f45281630c7e53
|
|
4
|
+
data.tar.gz: 4273cbbb581e5e7f7a2d126352403e6fa12e0292
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0841b864b264bc1683d484609f3b83f3fe4df1272d6b9e241709b6ce375176a846b70859bb469a9adbd90d31abc64ce062c04bfa05097ce25fec0f3bfa7e6d21
|
|
7
|
+
data.tar.gz: 5542ba5cfa46cb17d07a0f5496f79fa2f0a45f539e6c503a34972216868d89443d50acc15aa7e6ed86c4825eb4aa20919f9b03c79e266adef3f50ca3cb4076c9
|
data/{config/reek.yml → .reek}
RENAMED
|
@@ -6,9 +6,6 @@ FeatureEnvy:
|
|
|
6
6
|
exclude:
|
|
7
7
|
- LovelyRufus::Layers::BasicWrapper#call
|
|
8
8
|
- LovelyRufus::Layers::OneLetterGluer#call
|
|
9
|
-
- LovelyRufus::Layers::QuoteStripper#quote
|
|
10
|
-
# https://github.com/troessner/reek/issues/53
|
|
11
|
-
- LovelyRufus::Layers::HangoutWrapper::HangoutFinder
|
|
12
9
|
|
|
13
10
|
IrresponsibleModule:
|
|
14
11
|
enabled: false
|
|
@@ -16,8 +13,3 @@ IrresponsibleModule:
|
|
|
16
13
|
UncommunicativeVariableName:
|
|
17
14
|
exclude:
|
|
18
15
|
- LovelyRufus::Layers::HangoutWrapper#hangout_line
|
|
19
|
-
|
|
20
|
-
UtilityFunction:
|
|
21
|
-
exclude:
|
|
22
|
-
# https://github.com/troessner/reek/issues/27
|
|
23
|
-
- LovelyRufus::Layers::HangoutWrapper::HangoutFinder
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lovely_rufus (0.3.
|
|
5
|
-
private_attr (~> 1.
|
|
4
|
+
lovely_rufus (0.3.2)
|
|
5
|
+
private_attr (~> 1.1)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
@@ -12,8 +12,8 @@ GEM
|
|
|
12
12
|
ice_nine (~> 0.11.0)
|
|
13
13
|
memoizable (~> 0.4.0)
|
|
14
14
|
ast (2.0.0)
|
|
15
|
-
astrolabe (1.3.
|
|
16
|
-
parser (
|
|
15
|
+
astrolabe (1.3.1)
|
|
16
|
+
parser (~> 2.2)
|
|
17
17
|
bogus (0.1.6)
|
|
18
18
|
dependor (>= 0.0.4)
|
|
19
19
|
celluloid (0.16.0)
|
|
@@ -23,52 +23,52 @@ GEM
|
|
|
23
23
|
equalizer (~> 0.0.9)
|
|
24
24
|
dependor (1.0.1)
|
|
25
25
|
diff-lcs (1.2.5)
|
|
26
|
-
equalizer (0.0.
|
|
27
|
-
ffi (1.9.
|
|
26
|
+
equalizer (0.0.11)
|
|
27
|
+
ffi (1.9.10)
|
|
28
28
|
hitimes (1.2.2)
|
|
29
29
|
ice_nine (0.11.1)
|
|
30
|
-
listen (2.
|
|
31
|
-
celluloid (
|
|
30
|
+
listen (2.10.1)
|
|
31
|
+
celluloid (~> 0.16.0)
|
|
32
32
|
rb-fsevent (>= 0.9.3)
|
|
33
33
|
rb-inotify (>= 0.9)
|
|
34
34
|
memoizable (0.4.2)
|
|
35
35
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
36
|
-
minitest (5.
|
|
37
|
-
minitest-focus (1.1.
|
|
36
|
+
minitest (5.7.0)
|
|
37
|
+
minitest-focus (1.1.1)
|
|
38
38
|
minitest (>= 4, < 6)
|
|
39
|
-
parser (2.2.
|
|
39
|
+
parser (2.2.2.6)
|
|
40
40
|
ast (>= 1.1, < 3.0)
|
|
41
|
-
powerpack (0.1.
|
|
42
|
-
private_attr (1.
|
|
41
|
+
powerpack (0.1.1)
|
|
42
|
+
private_attr (1.1.0)
|
|
43
43
|
procto (0.0.2)
|
|
44
44
|
rainbow (2.0.0)
|
|
45
45
|
rake (10.4.2)
|
|
46
|
-
rb-fsevent (0.9.
|
|
46
|
+
rb-fsevent (0.9.5)
|
|
47
47
|
rb-inotify (0.9.5)
|
|
48
48
|
ffi (>= 0.5.0)
|
|
49
|
-
reek (
|
|
50
|
-
parser (~> 2.2)
|
|
49
|
+
reek (3.1)
|
|
50
|
+
parser (~> 2.2.2.5)
|
|
51
51
|
rainbow (~> 2.0)
|
|
52
52
|
unparser (~> 0.2.2)
|
|
53
53
|
rerun (0.10.0)
|
|
54
54
|
listen (~> 2.7, >= 2.7.3)
|
|
55
|
-
rubocop (0.
|
|
55
|
+
rubocop (0.32.1)
|
|
56
56
|
astrolabe (~> 1.3)
|
|
57
|
-
parser (>= 2.2.
|
|
57
|
+
parser (>= 2.2.2.5, < 3.0)
|
|
58
58
|
powerpack (~> 0.1)
|
|
59
59
|
rainbow (>= 1.99.1, < 3.0)
|
|
60
60
|
ruby-progressbar (~> 1.4)
|
|
61
|
-
ruby-progressbar (1.7.
|
|
62
|
-
thread_safe (0.3.
|
|
61
|
+
ruby-progressbar (1.7.5)
|
|
62
|
+
thread_safe (0.3.5)
|
|
63
63
|
timers (4.0.1)
|
|
64
64
|
hitimes
|
|
65
|
-
unparser (0.2.
|
|
65
|
+
unparser (0.2.4)
|
|
66
66
|
abstract_type (~> 0.0.7)
|
|
67
67
|
adamantium (~> 0.2.0)
|
|
68
68
|
concord (~> 0.1.5)
|
|
69
69
|
diff-lcs (~> 1.2.5)
|
|
70
70
|
equalizer (~> 0.0.9)
|
|
71
|
-
parser (~> 2.2.
|
|
71
|
+
parser (~> 2.2.2)
|
|
72
72
|
procto (~> 0.0.2)
|
|
73
73
|
|
|
74
74
|
PLATFORMS
|
|
@@ -77,9 +77,12 @@ PLATFORMS
|
|
|
77
77
|
DEPENDENCIES
|
|
78
78
|
bogus (~> 0.1.4)
|
|
79
79
|
lovely_rufus!
|
|
80
|
-
minitest (~> 5.
|
|
80
|
+
minitest (~> 5.6)
|
|
81
81
|
minitest-focus (~> 1.1)
|
|
82
82
|
rake (~> 10.1)
|
|
83
|
-
reek (~>
|
|
83
|
+
reek (~> 3.1)
|
|
84
84
|
rerun (~> 0.10.0)
|
|
85
|
-
rubocop (~> 0.
|
|
85
|
+
rubocop (~> 0.32.0)
|
|
86
|
+
|
|
87
|
+
BUNDLED WITH
|
|
88
|
+
1.10.5
|
data/Rakefile
CHANGED
data/lib/lovely_rufus.rb
CHANGED
data/lovely_rufus.gemspec
CHANGED
|
@@ -7,19 +7,21 @@ Gem::Specification.new do |gem|
|
|
|
7
7
|
gem.license = 'AGPL-3.0'
|
|
8
8
|
gem.name = 'lovely_rufus'
|
|
9
9
|
gem.summary = 'lovely_rufus: text wrapper'
|
|
10
|
-
gem.version = '0.3.
|
|
10
|
+
gem.version = '0.3.2'
|
|
11
|
+
|
|
12
|
+
gem.required_ruby_version = '~> 2.1'
|
|
11
13
|
|
|
12
14
|
gem.files = `git ls-files -z`.split("\0")
|
|
13
|
-
gem.executables = gem.files.grep(
|
|
14
|
-
gem.test_files = gem.files.grep(
|
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |path| File.basename(path) }
|
|
16
|
+
gem.test_files = gem.files.grep(%r{^test/.*\.rb$})
|
|
15
17
|
|
|
16
|
-
gem.add_dependency 'private_attr', '~> 1.
|
|
18
|
+
gem.add_dependency 'private_attr', '~> 1.1'
|
|
17
19
|
|
|
18
20
|
gem.add_development_dependency 'bogus', '~> 0.1.4'
|
|
19
|
-
gem.add_development_dependency 'minitest', '~> 5.
|
|
21
|
+
gem.add_development_dependency 'minitest', '~> 5.6'
|
|
20
22
|
gem.add_development_dependency 'minitest-focus', '~> 1.1'
|
|
21
23
|
gem.add_development_dependency 'rake', '~> 10.1'
|
|
22
|
-
gem.add_development_dependency 'reek', '~>
|
|
24
|
+
gem.add_development_dependency 'reek', '~> 3.1'
|
|
23
25
|
gem.add_development_dependency 'rerun', '~> 0.10.0'
|
|
24
|
-
gem.add_development_dependency 'rubocop', '~> 0.
|
|
26
|
+
gem.add_development_dependency 'rubocop', '~> 0.32.0'
|
|
25
27
|
end
|
|
@@ -11,16 +11,16 @@ module LovelyRufus
|
|
|
11
11
|
|
|
12
12
|
it 'reads the passed stream to TextWrapper and prints the results' do
|
|
13
13
|
stub(text_wrapper).wrap(text, width: 72) { text }
|
|
14
|
-
lambda do
|
|
14
|
+
_(lambda do
|
|
15
15
|
CLIWrapper.new(text_wrapper: text_wrapper).run stream
|
|
16
|
-
end.must_output text
|
|
16
|
+
end).must_output text
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
it 'accepts the desired width and passes it to TextWrapper' do
|
|
20
20
|
capture_io do
|
|
21
21
|
CLIWrapper.new(%w(--width=22), text_wrapper: text_wrapper).run stream
|
|
22
22
|
end
|
|
23
|
-
text_wrapper.must_have_received :wrap, [text, { width: 22 }]
|
|
23
|
+
_(text_wrapper).must_have_received :wrap, [text, { width: 22 }]
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -15,7 +15,7 @@ module LovelyRufus
|
|
|
15
15
|
with a souped-up tempo
|
|
16
16
|
end
|
|
17
17
|
bw = BasicWrapper.new
|
|
18
|
-
bw.call(Wrap[text, width: 22]).must_equal Wrap[wrap, width: 22]
|
|
18
|
+
_(bw.call(Wrap[text, width: 22])).must_equal Wrap[wrap, width: 22]
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it 'extends past the given width when necessary' do
|
|
@@ -31,7 +31,7 @@ module LovelyRufus
|
|
|
31
31
|
mushroom
|
|
32
32
|
end
|
|
33
33
|
bw = BasicWrapper.new
|
|
34
|
-
bw.call(Wrap[text, width: 5]).must_equal Wrap[wrap, width: 5]
|
|
34
|
+
_(bw.call(Wrap[text, width: 5])).must_equal Wrap[wrap, width: 5]
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
it 'rewraps a String from zero' do
|
|
@@ -40,14 +40,15 @@ module LovelyRufus
|
|
|
40
40
|
the lights and I’ll glow
|
|
41
41
|
end
|
|
42
42
|
wrap = "turn off the lights and I’ll glow\n"
|
|
43
|
-
BasicWrapper.new.call(Wrap[text]).must_equal Wrap[wrap]
|
|
43
|
+
_(BasicWrapper.new.call(Wrap[text])).must_equal Wrap[wrap]
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
it 'passes the fixed text to the next layer and returns its outcome' do
|
|
47
47
|
final = fake(:wrap)
|
|
48
48
|
layer = fake(:layer)
|
|
49
49
|
mock(layer).call(Wrap["I\nO\nU\n", width: 2]) { final }
|
|
50
|
-
BasicWrapper.new(layer).call(Wrap['I O U', width: 2])
|
|
50
|
+
call = BasicWrapper.new(layer).call(Wrap['I O U', width: 2])
|
|
51
|
+
_(call).must_equal final
|
|
51
52
|
end
|
|
52
53
|
end
|
|
53
54
|
end
|
|
@@ -25,7 +25,7 @@ module LovelyRufus
|
|
|
25
25
|
# Miami’s on the scene just in case you didn’t know it
|
|
26
26
|
end
|
|
27
27
|
commented = Wrap[text, width: 72]
|
|
28
|
-
CodeCommentStripper.new.call(commented).must_equal commented
|
|
28
|
+
_(CodeCommentStripper.new.call(commented)).must_equal commented
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it 'does not touch non-commented texts' do
|
|
@@ -34,12 +34,12 @@ module LovelyRufus
|
|
|
34
34
|
enough to shake and kick holes in the ground
|
|
35
35
|
end
|
|
36
36
|
uncommented = Wrap[text, width: 72]
|
|
37
|
-
CodeCommentStripper.new.call(uncommented).must_equal uncommented
|
|
37
|
+
_(CodeCommentStripper.new.call(uncommented)).must_equal uncommented
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it 'does not alter text contents' do
|
|
41
41
|
wrap = Wrap['# Ice # Ice # Baby']
|
|
42
|
-
CodeCommentStripper.new.call(wrap).must_equal wrap
|
|
42
|
+
_(CodeCommentStripper.new.call(wrap)).must_equal wrap
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
it 'strips // code comments' do
|
|
@@ -25,7 +25,7 @@ module LovelyRufus
|
|
|
25
25
|
> Miami’s on the scene just in case you didn’t know it
|
|
26
26
|
end
|
|
27
27
|
wrap = Wrap[quoted, width: 72]
|
|
28
|
-
EmailQuoteStripper.new.call(wrap).must_equal wrap
|
|
28
|
+
_(EmailQuoteStripper.new.call(wrap)).must_equal wrap
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it 'does not touch non-quoted texts' do
|
|
@@ -34,12 +34,12 @@ module LovelyRufus
|
|
|
34
34
|
enough to shake and kick holes in the ground
|
|
35
35
|
end
|
|
36
36
|
wrap = Wrap[plain, width: 72]
|
|
37
|
-
EmailQuoteStripper.new.call(wrap).must_equal wrap
|
|
37
|
+
_(EmailQuoteStripper.new.call(wrap)).must_equal wrap
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it 'does not alter text contents' do
|
|
41
41
|
wrap = Wrap['> Ice > Ice > Baby']
|
|
42
|
-
EmailQuoteStripper.new.call(wrap).must_equal wrap
|
|
42
|
+
_(EmailQuoteStripper.new.call(wrap)).must_equal wrap
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
it 'strips multilevel quotes' do
|
|
@@ -80,7 +80,7 @@ module LovelyRufus
|
|
|
80
80
|
>>> cut like a razor blade
|
|
81
81
|
end
|
|
82
82
|
wrap = Wrap[quoted, width: 72]
|
|
83
|
-
EmailQuoteStripper.new.call(wrap).must_equal Wrap[fixed, width: 72]
|
|
83
|
+
_(EmailQuoteStripper.new.call(wrap)).must_equal Wrap[fixed, width: 72]
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
it 'only considers homogenous characters as comments' do
|
|
@@ -16,7 +16,7 @@ module LovelyRufus
|
|
|
16
16
|
and a hi-hat with a souped-up tempo
|
|
17
17
|
end
|
|
18
18
|
hw = HangoutWrapper.new
|
|
19
|
-
hw.call(Wrap[text, width: 35]).must_equal Wrap[wrap, width: 35]
|
|
19
|
+
_(hw.call(Wrap[text, width: 35])).must_equal Wrap[wrap, width: 35]
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
it 'passes the fixed text to the next layer and returns its outcome' do
|
|
@@ -24,7 +24,7 @@ module LovelyRufus
|
|
|
24
24
|
layer = fake(:layer)
|
|
25
25
|
mock(layer).call(any(Wrap)) { final }
|
|
26
26
|
wrapped = HangoutWrapper.new(layer).call(Wrap["I O\nU", width: 4])
|
|
27
|
-
wrapped.must_equal final
|
|
27
|
+
_(wrapped).must_equal final
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
it 'doesn’t let the last line to hang out' do
|
|
@@ -32,7 +32,7 @@ module LovelyRufus
|
|
|
32
32
|
Just found out the Finnish term for grammar Nazi is pilkunnussija.
|
|
33
33
|
Direct translation: comma fucker. You’re welcome.
|
|
34
34
|
end
|
|
35
|
-
HangoutWrapper.new.call(Wrap[text, width: 76]).text.must_equal text
|
|
35
|
+
_(HangoutWrapper.new.call(Wrap[text, width: 76]).text).must_equal text
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
end
|
|
@@ -10,14 +10,14 @@ module LovelyRufus
|
|
|
10
10
|
text = 'I go crazy when I hear a cymbal and a hi-hat'
|
|
11
11
|
glue = 'I go crazy when I hear a cymbal and a hi-hat'
|
|
12
12
|
olg = OneLetterGluer.new
|
|
13
|
-
olg.call(Wrap[text, width: 42]).must_equal Wrap[glue, width: 42]
|
|
13
|
+
_(olg.call(Wrap[text, width: 42])).must_equal Wrap[glue, width: 42]
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it 'glues subsequent one-letter words' do
|
|
17
17
|
text = 'one-letter words in English: a, I & o'
|
|
18
18
|
glue = 'one-letter words in English: a, I & o'
|
|
19
19
|
olg = OneLetterGluer.new
|
|
20
|
-
olg.call(Wrap[text, width: 42]).must_equal Wrap[glue, width: 42]
|
|
20
|
+
_(olg.call(Wrap[text, width: 42])).must_equal Wrap[glue, width: 42]
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it 'passes the fixed text to the next layer and returns its outcome' do
|
|
@@ -25,7 +25,7 @@ module LovelyRufus
|
|
|
25
25
|
layer = fake(:layer)
|
|
26
26
|
mock(layer).call(Wrap['I O U', width: 69]) { final }
|
|
27
27
|
glued = OneLetterGluer.new(layer).call(Wrap['I O U', width: 69])
|
|
28
|
-
glued.must_equal final
|
|
28
|
+
_(glued).must_equal final
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
end
|
|
@@ -5,15 +5,15 @@ module LovelyRufus
|
|
|
5
5
|
describe Settings do
|
|
6
6
|
describe '#width' do
|
|
7
7
|
it 'defaults to 72' do
|
|
8
|
-
Settings.new([]).width.must_equal 72
|
|
8
|
+
_(Settings.new([]).width).must_equal 72
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
it 'can be set via --width' do
|
|
12
|
-
Settings.new(%w(--width=42)).width.must_equal 42
|
|
12
|
+
_(Settings.new(%w(--width=42)).width).must_equal 42
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it 'can be set via -w' do
|
|
16
|
-
Settings.new(%w(-w 42)).width.must_equal 42
|
|
16
|
+
_(Settings.new(%w(-w 42)).width).must_equal 42
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -12,18 +12,18 @@ module LovelyRufus
|
|
|
12
12
|
all right: stop, collaborate and listen
|
|
13
13
|
– Ice is back with a brand new invention
|
|
14
14
|
end
|
|
15
|
-
TextWrapper.wrap(short).must_equal "#{short}\n"
|
|
16
|
-
TextWrapper.wrap(long).must_equal wrap
|
|
15
|
+
_(TextWrapper.wrap(short)).must_equal "#{short}\n"
|
|
16
|
+
_(TextWrapper.wrap(long)).must_equal wrap
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
it 'wraps the passed String to the given number of characters' do
|
|
20
20
|
input = 'something grabs a hold of me tightly; ' \
|
|
21
21
|
'flow like a harpoon – daily and nightly'
|
|
22
|
-
TextWrapper.wrap(input, width: 40).must_equal <<-end.dedent
|
|
22
|
+
_(TextWrapper.wrap(input, width: 40)).must_equal <<-end.dedent
|
|
23
23
|
something grabs a hold of me tightly;
|
|
24
24
|
flow like a harpoon – daily and nightly
|
|
25
25
|
end
|
|
26
|
-
TextWrapper.wrap(input, width: 21).must_equal <<-end.dedent
|
|
26
|
+
_(TextWrapper.wrap(input, width: 21)).must_equal <<-end.dedent
|
|
27
27
|
something grabs
|
|
28
28
|
a hold of me tightly;
|
|
29
29
|
flow like a harpoon
|
|
@@ -37,7 +37,7 @@ module LovelyRufus
|
|
|
37
37
|
the lights and I’ll glow
|
|
38
38
|
end
|
|
39
39
|
wrapped = TextWrapper.wrap(broken)
|
|
40
|
-
wrapped.must_equal "turn off the lights and I’ll glow\n"
|
|
40
|
+
_(wrapped).must_equal "turn off the lights and I’ll glow\n"
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
it 'supports all the example use-cases' do
|
|
@@ -45,7 +45,7 @@ module LovelyRufus
|
|
|
45
45
|
YAML.load_file(path).each do |spec|
|
|
46
46
|
width = spec.fetch('width') { 72 }
|
|
47
47
|
wrap = "#{spec['output']}\n"
|
|
48
|
-
TextWrapper.wrap(spec['input'], width: width).must_equal wrap
|
|
48
|
+
_(TextWrapper.wrap(spec['input'], width: width)).must_equal wrap
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -5,19 +5,19 @@ module LovelyRufus
|
|
|
5
5
|
describe Wrap do
|
|
6
6
|
describe '.[]' do
|
|
7
7
|
it 'creates a Wrap with the given text and target width' do
|
|
8
|
-
Wrap['Ice Ice Baby', width: 7].text.must_equal 'Ice Ice Baby'
|
|
9
|
-
Wrap['Ice Ice Baby', width: 7].width.must_equal 7
|
|
8
|
+
_(Wrap['Ice Ice Baby', width: 7].text).must_equal 'Ice Ice Baby'
|
|
9
|
+
_(Wrap['Ice Ice Baby', width: 7].width).must_equal 7
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it 'defaults to empty text and width of 72' do
|
|
13
|
-
Wrap[].text.must_equal ''
|
|
14
|
-
Wrap[].width.must_equal 72
|
|
13
|
+
_(Wrap[].text).must_equal ''
|
|
14
|
+
_(Wrap[].width).must_equal 72
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
describe '#lines' do
|
|
19
19
|
it 'accesses the lines of the text' do
|
|
20
|
-
Wrap["all right: stop,\ncollaborate and listen\n"].lines.must_equal [
|
|
20
|
+
_(Wrap["all right: stop,\ncollaborate and listen\n"].lines).must_equal [
|
|
21
21
|
"all right: stop,\n", "collaborate and listen\n"
|
|
22
22
|
]
|
|
23
23
|
end
|
|
@@ -25,13 +25,13 @@ module LovelyRufus
|
|
|
25
25
|
|
|
26
26
|
describe '#text' do
|
|
27
27
|
it 'accesses the text of the Wrap' do
|
|
28
|
-
Wrap['Ice Ice Baby', width: 7].text.must_equal 'Ice Ice Baby'
|
|
28
|
+
_(Wrap['Ice Ice Baby', width: 7].text).must_equal 'Ice Ice Baby'
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
describe '#width' do
|
|
33
33
|
it 'accesses the target width of the Wrap' do
|
|
34
|
-
Wrap['Ice Ice Baby', width: 7].width.must_equal 7
|
|
34
|
+
_(Wrap['Ice Ice Baby', width: 7].width).must_equal 7
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
end
|
data/test/lovely_rufus_test.rb
CHANGED
|
@@ -7,13 +7,13 @@ describe LovelyRufus do
|
|
|
7
7
|
|
|
8
8
|
it 'offloads the wrapping to TextWrapper' do
|
|
9
9
|
stub(text_wrapper).wrap('Ice Ice Baby', width: 7) { "Ice Ice\nBaby\n" }
|
|
10
|
-
LovelyRufus.wrap('Ice Ice Baby', text_wrapper: text_wrapper, width: 7)
|
|
10
|
+
_(LovelyRufus.wrap('Ice Ice Baby', text_wrapper: text_wrapper, width: 7))
|
|
11
11
|
.must_equal "Ice Ice\nBaby\n"
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
it 'wraps the passed String to 72 characters by default' do
|
|
15
15
|
LovelyRufus.wrap 'Ice Ice Baby', text_wrapper: text_wrapper
|
|
16
|
-
text_wrapper.must_have_received :wrap, ['Ice Ice Baby', { width: 72 }]
|
|
16
|
+
_(text_wrapper).must_have_received :wrap, ['Ice Ice Baby', { width: 72 }]
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
data/test/test_helper.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
ENV['MT_NO_EXPECTATIONS'] = 'true'
|
|
1
2
|
require 'bundler/setup'
|
|
2
3
|
require 'minitest/autorun'
|
|
3
4
|
require 'minitest/focus'
|
|
@@ -8,8 +9,7 @@ require_relative '../lib/lovely_rufus/layers/layer'
|
|
|
8
9
|
require_relative '../lib/lovely_rufus/wrap'
|
|
9
10
|
|
|
10
11
|
Bogus.configure do |config|
|
|
11
|
-
config.search_modules << LovelyRufus
|
|
12
|
-
config.search_modules << LovelyRufus::Layers
|
|
12
|
+
config.search_modules << LovelyRufus << LovelyRufus::Layers
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
class String
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lovely_rufus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
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-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: private_attr
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.
|
|
19
|
+
version: '1.1'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.
|
|
26
|
+
version: '1.1'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: bogus
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '5.
|
|
47
|
+
version: '5.6'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '5.
|
|
54
|
+
version: '5.6'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: minitest-focus
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,14 +86,14 @@ dependencies:
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
89
|
+
version: '3.1'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
96
|
+
version: '3.1'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: rerun
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,14 +114,14 @@ dependencies:
|
|
|
114
114
|
requirements:
|
|
115
115
|
- - "~>"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: 0.
|
|
117
|
+
version: 0.32.0
|
|
118
118
|
type: :development
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
122
|
- - "~>"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: 0.
|
|
124
|
+
version: 0.32.0
|
|
125
125
|
description: An executable and a Ruby library for wrapping paragraphs of text.
|
|
126
126
|
email: chastell@chastell.net
|
|
127
127
|
executables:
|
|
@@ -129,15 +129,16 @@ executables:
|
|
|
129
129
|
extensions: []
|
|
130
130
|
extra_rdoc_files: []
|
|
131
131
|
files:
|
|
132
|
+
- ".reek"
|
|
132
133
|
- ".rubocop.yml"
|
|
133
134
|
- ".ruby-version"
|
|
135
|
+
- ".travis.yml"
|
|
134
136
|
- Gemfile
|
|
135
137
|
- Gemfile.lock
|
|
136
138
|
- LICENCE
|
|
137
139
|
- README.md
|
|
138
140
|
- Rakefile
|
|
139
141
|
- bin/lovely-rufus
|
|
140
|
-
- config/reek.yml
|
|
141
142
|
- lib/lovely_rufus.rb
|
|
142
143
|
- lib/lovely_rufus/cli_wrapper.rb
|
|
143
144
|
- lib/lovely_rufus/layers/basic_wrapper.rb
|
|
@@ -173,9 +174,9 @@ require_paths:
|
|
|
173
174
|
- lib
|
|
174
175
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
175
176
|
requirements:
|
|
176
|
-
- - "
|
|
177
|
+
- - "~>"
|
|
177
178
|
- !ruby/object:Gem::Version
|
|
178
|
-
version: '
|
|
179
|
+
version: '2.1'
|
|
179
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
181
|
requirements:
|
|
181
182
|
- - ">="
|
|
@@ -183,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
183
184
|
version: '0'
|
|
184
185
|
requirements: []
|
|
185
186
|
rubyforge_project:
|
|
186
|
-
rubygems_version: 2.4.
|
|
187
|
+
rubygems_version: 2.4.8
|
|
187
188
|
signing_key:
|
|
188
189
|
specification_version: 4
|
|
189
190
|
summary: 'lovely_rufus: text wrapper'
|
|
@@ -199,3 +200,4 @@ test_files:
|
|
|
199
200
|
- test/lovely_rufus/wrap_test.rb
|
|
200
201
|
- test/lovely_rufus_test.rb
|
|
201
202
|
- test/test_helper.rb
|
|
203
|
+
has_rdoc:
|