beaneater 1.1.1 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60e34aa7bfb6dc0a66ce540b609fa2ed112af52a7defcb3d7148efdbf9a8d213
4
- data.tar.gz: 36c9c9cf9a1d2330243f4f8dbd664318bda4b702ecc1c160e9a288255b211764
3
+ metadata.gz: ffe398358517da9e09fd22e17ddd4421e7a0f2b7fa2ae816e8ad0a308466f2d8
4
+ data.tar.gz: 7f9d831b5318de310462d8d4405acc0dbedb82463d5b252dec9b63fbcb39677b
5
5
  SHA512:
6
- metadata.gz: e447f52b2790b98867e613009d7a31b3cc2af0c116656fe209514000f0a023d662a850328a3242609590f1a2fdfd9f006936f24aaf9b04d86d44f2a7b40a2dd4
7
- data.tar.gz: 90eca2d3c5db4c0c96a0bfccc774d894c2d942f9ea52979f15a0a5f6b0bb39990299896a994e56f7c60537e015fc152b7fa030293c980498b545e8f5c52cb411
6
+ metadata.gz: 0fd5812759fa6e28a830cecacdd7a22447ce94705b044d9c28062bb868a082ea3679a29b18e3c4f421a6abf90fb3ba28551a2715eb5e8b38782a6e842548dc08
7
+ data.tar.gz: 919952687b5f715aca936c4c40af28a0db741e6c7539dfdcb78c6e5834a855fb91800e5a2e5fc2cb0e201e6422b5522f7c944be787fa0ca7b145f6b3edf83091
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # CHANGELOG for Beaneater
2
2
 
3
+ ## 1.1.3 (Oct 14 2022)
4
+
5
+ * Fixes issue introduced in 1.1.2 re YML parsing (@pond)
6
+ * Fix job lookup test so it passes again
7
+
8
+ ## 1.1.2 (Oct 10 2022)
9
+
10
+ * Fixes beaneater when used with Ruby 3.1 and YAML 4 (@pond)
11
+
3
12
  ## 1.1.1 (April 27th 2021)
4
13
 
5
14
  * Support Ruby 3 keyword arguments (@yahonda)
@@ -150,7 +150,12 @@ class Beaneater
150
150
  if ['OK','FOUND', 'RESERVED'].include?(status)
151
151
  bytes_size = body_values[-1].to_i
152
152
  raw_body = connection.read(bytes_size)
153
- body = status == 'OK' ? YAML.load(raw_body) : config.job_parser.call(raw_body)
153
+ body = if status == 'OK'
154
+ psych_v4_valid_body = raw_body.gsub(/^(.*?): (.*)$/) { "#{$1}: #{$2.gsub(/[\:\-\~]/, '_')}" }
155
+ YAML.load(psych_v4_valid_body)
156
+ else
157
+ config.job_parser.call(raw_body)
158
+ end
154
159
  crlf = connection.read(2) # \r\n
155
160
  raise ExpectedCrlfError.new('EXPECTED_CRLF', cmd) if crlf != "\r\n"
156
161
  end
@@ -1,4 +1,4 @@
1
1
  class Beaneater
2
2
  # Current version of gem.
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.3"
4
4
  end
data/test/jobs_test.rb CHANGED
@@ -28,8 +28,12 @@ describe Beaneater::Jobs do
28
28
  assert_equal "foo find #{@time}", @jobs.find(@job.id).body
29
29
  end
30
30
 
31
- it "should return nil for invalid id" do
32
- assert_nil @jobs.find(-1)
31
+ it "should return nil for invalid negative id" do
32
+ assert_nil @jobs.find(10000)
33
+ end
34
+
35
+ it "should return nil for invalid negative id" do
36
+ assert_raises(Beaneater::BadFormatError) { @jobs.find(-1) }
33
37
  end
34
38
  end # find
35
39
 
data/test/test_helper.rb CHANGED
@@ -7,7 +7,7 @@ $:.unshift File.expand_path("../../lib")
7
7
  require 'beaneater'
8
8
  require 'timeout'
9
9
  begin
10
- require 'mocha/setup'
10
+ require 'mocha/minitest'
11
11
  rescue LoadError
12
12
  require 'mocha'
13
13
  end
data/test/tube_test.rb CHANGED
@@ -89,9 +89,9 @@ describe Beaneater::Tube do
89
89
 
90
90
  it "should support custom parser" do
91
91
  Beaneater.configure.job_parser = lambda { |b| JSON.parse(b) }
92
- json = '{"message":"hi"}'
92
+ json = '{"message": "hi: there! this: is a long message"}'
93
93
  @tube.put(json)
94
- assert_equal 'hi', @tube.peek(:ready).body['message']
94
+ assert_equal 'hi: there! this: is a long message', @tube.peek(:ready).body['message']
95
95
  end
96
96
 
97
97
  after do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaneater
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nico Taing
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-27 00:00:00.000000000 Z
11
+ date: 2022-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest