babysitter 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
@@ -19,13 +19,11 @@ module Babysitter
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def sanitise_subject(subject)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
subject
|
28
|
-
end
|
22
|
+
sanitised = /\s*([^\x00-\x1F]*)/.match(subject)[1]
|
23
|
+
|
24
|
+
return "(no subject)" if sanitised.empty?
|
25
|
+
return sanitised[0..96] + "..." if sanitised.size > 100
|
26
|
+
sanitised
|
29
27
|
end
|
30
28
|
|
31
29
|
def validate_topic
|
data/lib/babysitter/version.rb
CHANGED
@@ -54,6 +54,25 @@ module Babysitter
|
|
54
54
|
subject.notify(original_subject, message)
|
55
55
|
end
|
56
56
|
|
57
|
+
it "strips control characters" do
|
58
|
+
expected_subject = "this is the subject"
|
59
|
+
original_subject = "#{expected_subject}"
|
60
|
+
32.times.each { |code| original_subject << code.chr }
|
61
|
+
|
62
|
+
topic.should_receive(:publish).with(message, hash_including(subject: expected_subject))
|
63
|
+
|
64
|
+
subject.notify(original_subject, message)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "strips leading whitespace" do
|
68
|
+
expected_subject = "this is the subject"
|
69
|
+
original_subject = " #{expected_subject}"
|
70
|
+
|
71
|
+
topic.should_receive(:publish).with(message, hash_including(subject: expected_subject))
|
72
|
+
|
73
|
+
subject.notify(original_subject, message)
|
74
|
+
end
|
75
|
+
|
57
76
|
it "handles empty subject" do
|
58
77
|
topic.should_receive(:publish).with(message, hash_including(subject: "(no subject)"))
|
59
78
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: babysitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-02-
|
15
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: fozzie
|