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.
- data/lib/hq/tools/check-script.rb +1 -1
- data/spec/hq/tools/check-script-spec.rb +11 -1
- metadata +1 -1
@@ -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
|
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 "
|
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"
|