build_status_server 0.12 → 0.13

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- build_status_server (0.12)
4
+ build_status_server (0.13)
5
5
  json
6
6
 
7
7
  GEM
@@ -67,7 +67,12 @@ The address configured is not available (#{address})
67
67
 
68
68
 
69
69
  def process_job(data = "{}")
70
- job = JSON.parse(data)
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
 
@@ -1,3 +1,3 @@
1
1
  module BuildStatusServer
2
- VERSION = "0.12"
2
+ VERSION = "0.13"
3
3
  end
@@ -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!"})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build_status_server
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.12'
4
+ version: '0.13'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: