beanstalk_integration_tests 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ require 'beanstalk_integration_tests/test_helper'
2
+
3
+ class OtherTest < BeanstalkIntegrationTest
4
+
5
+ context 'Bad commands' do
6
+
7
+ should 'return UNKNOWN_COMMAND for a variery of bad commands' do
8
+ ['', "st\r\nats", '123', 'st ats', ' stats'].each do |command|
9
+ assert_raises(Beaneater::UnknownCommandError, 'Expected bad command to raise UNKNOWN_COMMAND') do
10
+ client.transmit(command)
11
+ end
12
+ end
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -25,8 +25,6 @@ class PeekTest < BeanstalkIntegrationTest
25
25
  initial_cmd_peek = client.transmit('stats')[:body]['cmd-peek']
26
26
  assert_raises(Beaneater::NotFoundError, 'Expected peeking non-existent job to return NOT_FOUND') do
27
27
  response = client.transmit("peek #{job_id}")
28
- debugger
29
- puts "#{job_id}: #{response.inspect}"
30
28
  end
31
29
  assert_equal(initial_cmd_peek + 1, client.transmit('stats')[:body]['cmd-peek'], 'Expected cmd-peek to be incremented')
32
30
  end
@@ -250,6 +250,24 @@ class PutTest < BeanstalkIntegrationTest
250
250
  assert_equal initial_cmd_put + 1, build_client.transmit('stats')[:body]['cmd-put']
251
251
  end
252
252
 
253
+
254
+ should 'accept body as separate transmission' do
255
+ stats = client.transmit('stats')[:body]
256
+ initial_current_producers = stats['current-producers']
257
+ initial_cmd_put = stats['cmd-put']
258
+ connection = client.connection
259
+ connection.write("put 0 0 120 #{@message.bytesize}\r\n")
260
+ connection.write("#{@message}\r\n")
261
+ response = connection.gets
262
+ assert_match(response, /INSERTED \d+\r\n/)
263
+ job_id = response.scan(/\d+/).first.to_i
264
+ job_tube = client.transmit("stats-job #{job_id}")[:body]['tube']
265
+ stats = client.transmit('stats')[:body]
266
+ assert_equal initial_cmd_put + 1, stats['cmd-put']
267
+ assert_equal initial_current_producers + 1, stats['current-producers']
268
+ assert_equal tube_name, job_tube
269
+ end
270
+
253
271
  end
254
272
 
255
273
  end
@@ -1,3 +1,3 @@
1
1
  module BeanstalkIntegrationTests
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beanstalk_integration_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-15 00:00:00.000000000 Z
12
+ date: 2013-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -113,6 +113,7 @@ files:
113
113
  - lib/beanstalk_integration_tests/list_tube_used_test.rb
114
114
  - lib/beanstalk_integration_tests/list_tubes_test.rb
115
115
  - lib/beanstalk_integration_tests/list_tubes_watched_test.rb
116
+ - lib/beanstalk_integration_tests/other_test.rb
116
117
  - lib/beanstalk_integration_tests/pause_tube_test.rb
117
118
  - lib/beanstalk_integration_tests/peek_test.rb
118
119
  - lib/beanstalk_integration_tests/put_test.rb