dogsay 0.2.3 → 0.2.4
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/lib/dogsay/version.rb +1 -1
- data/lib/dogsay.rb +4 -3
- data/spec/dogsay_spec.rb +12 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61ad1bbaef3bdabe95c7d6cf946b1b3a9fb57568
|
4
|
+
data.tar.gz: c8f03c1221a155a8bdf730288cc986101d327723
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f749d9167e7b4c7fb9a19fe08da78bcd67d8f16123c6e8a078bf8a3a0052b9c2dd29192309fc2968e2794408e587fadad2f3ccf2ab3600ed0ac683d32b6b2a08
|
7
|
+
data.tar.gz: b3860283688e5ff725ebf0b5afacda3a73f7c0d207661392680148d9de18324e95f3ce050e72267ea269bdb3669aad26026ff17f108f88cd7162145ef557b9d1
|
data/lib/dogsay/version.rb
CHANGED
data/lib/dogsay.rb
CHANGED
@@ -12,9 +12,10 @@ String.include CoreExtensions::String::Box
|
|
12
12
|
module Dogsay
|
13
13
|
class << self
|
14
14
|
def say(string, opts={})
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
options = config.merge opts
|
16
|
+
dog = Dogsay::Dog.new(options)
|
17
|
+
text = Dogsay::TextBox.new(string, options)
|
18
|
+
boxed = opts[:raw] ? text.raw : text.ascii
|
18
19
|
dog.add_art(boxed, on_the: dog.text_position)
|
19
20
|
end
|
20
21
|
|
data/spec/dogsay_spec.rb
CHANGED
@@ -4,16 +4,26 @@ RSpec.describe Dogsay do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
describe '#say' do
|
7
|
+
let(:defaults) do
|
8
|
+
{
|
9
|
+
animal: :dog,
|
10
|
+
pose: :default,
|
11
|
+
raw: false,
|
12
|
+
text_width: 40,
|
13
|
+
strip: false
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
7
17
|
it 'shoud bark' do
|
8
18
|
woof = File.open(File.join 'spec', 'fixtures', 'say_woof').read
|
9
|
-
expect(Dogsay.say('woof')).to eq woof
|
19
|
+
expect(Dogsay.say('woof', defaults)).to eq woof
|
10
20
|
end
|
11
21
|
|
12
22
|
it 'should know poetry' do
|
13
23
|
sappho = File.open(File.join 'spec', 'fixtures', 'say_sappho').read
|
14
24
|
poem = "We know this much\nDeath is an evil;\nwe have the gods'\n" <<
|
15
25
|
"word for it; they too\nwould die if death\nwere a good thing"
|
16
|
-
expect(Dogsay.say(poem)).to eq sappho
|
26
|
+
expect(Dogsay.say(poem, defaults)).to eq sappho
|
17
27
|
end
|
18
28
|
|
19
29
|
context 'without a configuration file' do
|