build_status_server 0.12 → 0.13
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/Gemfile.lock
CHANGED
@@ -67,7 +67,12 @@ The address configured is not available (#{address})
|
|
67
67
|
|
68
68
|
|
69
69
|
def process_job(data = "{}")
|
70
|
-
job =
|
70
|
+
job = begin
|
71
|
+
JSON.parse(data)
|
72
|
+
rescue JSON::ParserError => ex
|
73
|
+
STDERR.puts "Invalid JSON! (Or at least JSON wasn't able to parse it...)\nReceived: #{data}"
|
74
|
+
return false
|
75
|
+
end
|
71
76
|
|
72
77
|
build_name = job["name"]
|
73
78
|
|
@@ -224,6 +224,11 @@ describe BuildStatusServer::Server do
|
|
224
224
|
server.send(:process_job).should be_false
|
225
225
|
end
|
226
226
|
|
227
|
+
it "doesn't die if invalid JSON is passed in" do
|
228
|
+
STDERR.should_receive(:puts).with("Invalid JSON! (Or at least JSON wasn't able to parse it...)\nReceived: {b => \"123\"}")
|
229
|
+
expect { server.send(:process_job, '{b => "123"}') }.should_not raise_error(JSON::ParserError)
|
230
|
+
end
|
231
|
+
|
227
232
|
it "returns false and says so on stderr if payload doesn't have a hash for build" do
|
228
233
|
server.should_receive(:should_process_build).and_return(true)
|
229
234
|
JSON.should_receive(:parse).and_return({"build" => "Not a hash!"})
|