hq-tools 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.
@@ -109,7 +109,7 @@ class CheckScript
109
109
  parts[2] = options[:critical].to_s if options[:critical]
110
110
  parts[3] = options[:minimum].to_s if options[:minimum]
111
111
  parts[4] = options[:maximum].to_s if options[:maximum]
112
- name = "'#{name.gsub "'", "''"}'" if name.include? "'"
112
+ name = "'#{name.gsub "'", "''"}'" if name =~ /[ ']/
113
113
  @performances << "%s=%s" % [ name, parts.join(";") ]
114
114
  end
115
115
 
@@ -32,7 +32,7 @@ describe CheckScript do
32
32
  "Unnamed OK: hello | metric1=1\n"
33
33
  end
34
34
 
35
- it "special chars" do
35
+ it "apostrophe" do
36
36
  subject.stub(:perform_checks) do
37
37
  subject.message "hello"
38
38
  subject.performance "apos'trophe", 1
@@ -42,6 +42,16 @@ describe CheckScript do
42
42
  "Unnamed OK: hello | 'apos''trophe'=1\n"
43
43
  end
44
44
 
45
+ it "whitespace" do
46
+ subject.stub(:perform_checks) do
47
+ subject.message "hello"
48
+ subject.performance "white space", 1
49
+ end
50
+ subject.main
51
+ subject.stdout.string.should ==
52
+ "Unnamed OK: hello | 'white space'=1\n"
53
+ end
54
+
45
55
  it "optional fields" do
46
56
  subject.stub(:perform_checks) do
47
57
  subject.message "hello"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hq-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: