coney_island 0.0.6 → 0.0.7

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
  SHA1:
3
- metadata.gz: c02ec5e2739e99b82cac31f7b393b6bde299f7f4
4
- data.tar.gz: 2587ce1a6f993c4b273a341a7c0f3d216dd82cd4
3
+ metadata.gz: bf90adcd9f29187fbfd2e7733e1c3a258ad34553
4
+ data.tar.gz: 91b6851a230f62ba75e28d6508a19c3877eac52b
5
5
  SHA512:
6
- metadata.gz: 5cf7270c89c814973c28decd113525ac793d03293217ab470d8d953c4da3768bba5bf01dc10257fc678fee402d19d0f10b64d7c2f915300cae5761f0047d540a
7
- data.tar.gz: 73595b08270efb41d1101ba4bd2895faac1436e012ba4ad140ef4b5514a387d4ab23f6cf8703e5c09526c443b27d0f0c1c7ba8c1709cb5c0991984c3c389c6cd
6
+ metadata.gz: a36841285a8c2c42f4cbb77d950d98d4feebe418e5b5b67604ae49d6d58a6eb4b2145920c63c3fd1f7359fd81ceddd9bf8199c5eb4dd13c95a0f4d45382a410f
7
+ data.tar.gz: 35e57d874f72ccb0871fafded99c2316ba073c2f35d782f39b2fd0a45eb6c57b4b9e12a666579497c1c10ed4c6993dbe5292425da6c1be7f885f54db3701d0ca
@@ -1,3 +1,3 @@
1
1
  module ConeyIsland
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -30,7 +30,7 @@ module ConeyIsland
30
30
  @log_io = self.config[:log]
31
31
  self.log = Logger.new(@log_io)
32
32
 
33
- @instance_config = self.config[:carousels][@ticket]
33
+ @instance_config = self.config[:carousels][@ticket.to_sym]
34
34
 
35
35
  @prefetch_count = @instance_config[:prefetch_count] if @instance_config
36
36
  @prefetch_count ||= 20
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class ConeyIslandTest < MiniTest::Test
4
- describe "running jobs" do
4
+ describe "ConeyIsland running jobs" do
5
5
  it "runs inline" do
6
6
  ConeyIsland.run_inline
7
7
  my_array = []
@@ -1,33 +1,35 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class SubmitterTest < MiniTest::Test
4
- describe "running jobs inline" do
5
- it "calls the worker directly" do
6
- @execute_job_method = Minitest::Mock.new
7
- @execute_job_method.expect :call, nil, [Hash]
8
- ConeyIsland::Worker.stub(:execute_job_method,@execute_job_method) do
9
- ConeyIsland::Submitter.run_inline
10
- ConeyIsland::Submitter.submit(TestModel, :add_to_list, args: [[]])
4
+ describe "ConeyIsland::Submitter" do
5
+ describe "running jobs inline" do
6
+ it "calls the worker directly" do
7
+ @execute_job_method = Minitest::Mock.new
8
+ @execute_job_method.expect :call, nil, [Hash]
9
+ ConeyIsland::Worker.stub(:execute_job_method,@execute_job_method) do
10
+ ConeyIsland::Submitter.run_inline
11
+ ConeyIsland::Submitter.submit(TestModel, :add_to_list, args: [[]])
12
+ end
13
+ @execute_job_method.verify
11
14
  end
12
- @execute_job_method.verify
13
15
  end
14
- end
15
- describe "running jobs in the background" do
16
- it "publishes the job to the message bus" do
17
- @exchange = Minitest::Mock.new
18
- @exchange.expect :publish, nil, [String,Hash]
19
- @next_tick = Minitest::Mock.new
20
- @next_tick.expect :call, nil, []
21
- EventMachine.stub(:next_tick, @next_tick) do
22
- ConeyIsland.stub(:handle_connection, nil) do
23
- ConeyIsland.stub(:exchange, @exchange) do
24
- ConeyIsland::Submitter.stop_running_inline
25
- ConeyIsland::Submitter.submit(TestModel, :add_to_list, args: [[]])
16
+ describe "running jobs in the background" do
17
+ it "publishes the job to the message bus" do
18
+ @exchange = Minitest::Mock.new
19
+ @exchange.expect :publish, nil, [String,Hash]
20
+ @next_tick = Minitest::Mock.new
21
+ @next_tick.expect :call, nil, []
22
+ EventMachine.stub(:next_tick, @next_tick) do
23
+ ConeyIsland::Submitter.stub(:handle_connection, nil) do
24
+ ConeyIsland::Submitter.stub(:exchange, @exchange) do
25
+ ConeyIsland::Submitter.stop_running_inline
26
+ ConeyIsland::Submitter.submit(TestModel, :add_to_list, args: [[]])
27
+ end
26
28
  end
27
29
  end
30
+ @next_tick.verify
31
+ @exchange.verify
28
32
  end
29
- @next_tick.verify
30
- @exchange.verify
31
33
  end
32
34
  end
33
35
  end
data/test/worker_test.rb CHANGED
@@ -1,51 +1,53 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class WorkerTest < MiniTest::Test
4
- describe "handling jobs" do
5
- before do
6
- @metadata = MiniTest::Mock.new
7
- @metadata.expect :ack, nil
8
- end
9
- it "handles timeouts with 3 retries before bailing out" do
10
- ConeyIsland::Worker.job_attempts['my_job_id'] = 1
11
- ConeyIsland::Worker.job_attempts.stub(:delete,nil) do
12
- ConeyIsland::Worker.handle_job(@metadata,{
13
- 'klass' => 'TestModel',
14
- 'method_name' => :take_too_long,
15
- 'timeout' => 0.01
16
- },'my_job_id')
4
+ describe "ConeyIsland::Worker" do
5
+ describe "handling jobs" do
6
+ before do
7
+ @metadata = MiniTest::Mock.new
8
+ @metadata.expect :ack, nil
17
9
  end
18
- ConeyIsland::Worker.job_attempts['my_job_id'].must_equal 3
19
- end
20
- it "sends other exeptions to a notification service" do
21
- @poke_the_badger = MiniTest::Mock.new
22
- @poke_the_badger.expect :call, nil, [Exception,Hash]
23
- ConeyIsland::Worker.stub(:poke_the_badger,@poke_the_badger) do
10
+ it "handles timeouts with 3 retries before bailing out" do
11
+ ConeyIsland::Worker.job_attempts['my_job_id'] = 1
12
+ ConeyIsland::Worker.job_attempts.stub(:delete,nil) do
13
+ ConeyIsland::Worker.handle_job(@metadata,{
14
+ 'klass' => 'TestModel',
15
+ 'method_name' => :take_too_long,
16
+ 'timeout' => 0.01
17
+ },'my_job_id')
18
+ end
19
+ ConeyIsland::Worker.job_attempts['my_job_id'].must_equal 3
20
+ end
21
+ it "sends other exeptions to a notification service" do
22
+ @poke_the_badger = MiniTest::Mock.new
23
+ @poke_the_badger.expect :call, nil, [Exception,Hash]
24
+ ConeyIsland::Worker.stub(:poke_the_badger,@poke_the_badger) do
25
+ ConeyIsland::Worker.handle_job(@metadata,{
26
+ 'klass' => 'TestModel',
27
+ 'method_name' => :throw_an_error
28
+ },'my_job_id')
29
+ end
30
+ @poke_the_badger.verify
31
+ end
32
+ it "calls find on the submitted class if an instance_id is present" do
33
+ TestModel.new('id' => 'my_id')
24
34
  ConeyIsland::Worker.handle_job(@metadata,{
25
35
  'klass' => 'TestModel',
26
- 'method_name' => :throw_an_error
36
+ 'method_name' => :set_color,
37
+ 'instance_id' => 'my_id',
38
+ 'args' => ['green']
27
39
  },'my_job_id')
40
+ my_thing = TestModel.find('my_id')
41
+ my_thing.color.must_equal 'green'
42
+ end
43
+ it "acknowledges job completion to the message bus" do
44
+ ConeyIsland::Worker.handle_job(@metadata,
45
+ { 'klass' => 'TestModel',
46
+ 'method_name' => :add_to_list,
47
+ 'args' => [[]]},
48
+ 'my_job_id')
49
+ @metadata.verify
28
50
  end
29
- @poke_the_badger.verify
30
- end
31
- it "calls find on the submitted class if an instance_id is present" do
32
- TestModel.new('id' => 'my_id')
33
- ConeyIsland::Worker.handle_job(@metadata,{
34
- 'klass' => 'TestModel',
35
- 'method_name' => :set_color,
36
- 'instance_id' => 'my_id',
37
- 'args' => ['green']
38
- },'my_job_id')
39
- my_thing = TestModel.find('my_id')
40
- my_thing.color.must_equal 'green'
41
- end
42
- it "acknowledges job completion to the message bus" do
43
- ConeyIsland::Worker.handle_job(@metadata,
44
- { 'klass' => 'TestModel',
45
- 'method_name' => :add_to_list,
46
- 'args' => [[]]},
47
- 'my_job_id')
48
- @metadata.verify
49
51
  end
50
52
  end
51
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coney_island
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
@@ -144,8 +144,6 @@ files:
144
144
  - test/dummy/config/locales/en.yml
145
145
  - test/dummy/config/routes.rb
146
146
  - test/dummy/config/secrets.yml
147
- - test/dummy/db/test.sqlite3
148
- - test/dummy/log/test.log
149
147
  - test/dummy/public/404.html
150
148
  - test/dummy/public/422.html
151
149
  - test/dummy/public/500.html
@@ -153,7 +151,7 @@ files:
153
151
  - test/submitter_test.rb
154
152
  - test/test_helper.rb
155
153
  - test/worker_test.rb
156
- homepage: https://github.com/edraut/coney_island
154
+ homepage: http://edraut.github.io/coney_island/
157
155
  licenses:
158
156
  - MIT
159
157
  metadata: {}
@@ -209,8 +207,6 @@ test_files:
209
207
  - test/dummy/config/routes.rb
210
208
  - test/dummy/config/secrets.yml
211
209
  - test/dummy/config.ru
212
- - test/dummy/db/test.sqlite3
213
- - test/dummy/log/test.log
214
210
  - test/dummy/public/404.html
215
211
  - test/dummy/public/422.html
216
212
  - test/dummy/public/500.html
File without changes
File without changes