babysitter 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,16 +13,21 @@ module Babysitter
13
13
  end
14
14
 
15
15
  def notify(subject, msg)
16
- sanitised_subject = if subject.size > 100
17
- subject[0..96] + "..."
18
- else
19
- subject
20
- end
21
- @topic.publish(msg, subject: sanitised_subject)
16
+ @topic.publish(msg, subject: sanitise_subject(subject))
22
17
  end
23
18
 
24
19
  private
25
20
 
21
+ def sanitise_subject(subject)
22
+ if subject.size > 100
23
+ subject[0..96] + "..."
24
+ elsif subject.empty?
25
+ "(no subject)"
26
+ else
27
+ subject
28
+ end
29
+ end
30
+
26
31
  def validate_topic
27
32
  @topic.display_name
28
33
  end
@@ -1,3 +1,3 @@
1
1
  module Babysitter
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -53,6 +53,12 @@ module Babysitter
53
53
 
54
54
  subject.notify(original_subject, message)
55
55
  end
56
+
57
+ it "handles empty subject" do
58
+ topic.should_receive(:publish).with(message, hash_including(subject: "(no subject)"))
59
+
60
+ subject.notify("", message)
61
+ end
56
62
  end
57
63
  end
58
64
  end
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.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: