employer 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -126,6 +126,9 @@ require "employer-mongoid"
126
126
  # backend.
127
127
  pipeline_backend Employer::Mongoid::Pipeline.new
128
128
 
129
+ # Add loggers to log. Logged output will go to all of the loggers defined here.
130
+ log_to ::Logger.new("./log/employer.log")
131
+
129
132
  # Use employees that fork subprocesses to perform jobs. You cannot use these
130
133
  # with JRuby, because JRuby doesn't support Process#fork.
131
134
  forking_employees 4
data/lib/employer/cli.rb CHANGED
@@ -67,6 +67,9 @@ require "employer-mongoid"
67
67
  # backend.
68
68
  pipeline_backend Employer::Mongoid::Pipeline.new
69
69
 
70
+ # Add loggers to log. Logged output will go to all of the loggers defined here.
71
+ log_to ::Logger.new("./log/employer.log")
72
+
70
73
  # Use employees that fork subprocesses to perform jobs. You cannot use these
71
74
  # with JRuby, because JRuby doesn't support Process#fork.
72
75
  forking_employees 4
@@ -1,3 +1,3 @@
1
1
  module Employer
2
- VERSION = "0.3"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -65,8 +65,8 @@ describe Employer::Boss do
65
65
  end
66
66
 
67
67
  describe "#delegate_work" do
68
- let(:job1) { double("Job 1") }
69
- let(:job2) { double("Job 2") }
68
+ let(:job1) { double("Job 1", id: 1) }
69
+ let(:job2) { double("Job 2", id: 2) }
70
70
  let(:employee1) { double("Employee 1") }
71
71
  let(:employee2) { double("Employee 2") }
72
72
  let(:employee3) { double("Employee 3") }
@@ -126,7 +126,7 @@ describe Employer::Boss do
126
126
  end
127
127
 
128
128
  it "increases resets sleep time when it gets a job" do
129
- job = double("Job")
129
+ job = double("Job", id: 1)
130
130
  pipeline.stub(:dequeue).and_return(nil, nil, job, job)
131
131
  boss.should_receive(:sleep).with(0.5).ordered
132
132
  boss.get_work.should be_nil
@@ -140,7 +140,7 @@ describe Employer::Boss do
140
140
  end
141
141
 
142
142
  describe "#update_job_status" do
143
- let(:job) { double("Job") }
143
+ let(:job) { double("Job", id: 1) }
144
144
  let(:employee) { employee = double("Employee", job: job) }
145
145
 
146
146
  it "completes the job and frees the employee if employee reports job completed" do
@@ -218,7 +218,7 @@ describe Employer::Boss do
218
218
  end
219
219
 
220
220
  describe "#delegate_job" do
221
- let(:job) { double("Job") }
221
+ let(:job) { double("Job", id: 1) }
222
222
 
223
223
  it "will put a free employee to work on a job" do
224
224
  employee.should_receive(:free?).and_return(true)
@@ -4,7 +4,7 @@ describe Employer::Pipeline do
4
4
  let(:logger) { double("Logger").as_null_object }
5
5
  let(:pipeline) { Employer::Pipeline.new(logger) }
6
6
  let(:backend) { double("Pipeline backend") }
7
- let(:job) { double("Job") }
7
+ let(:job) { double("Job", id: 1) }
8
8
 
9
9
  describe "#initialize" do
10
10
  let(:logger) { double("Logger") }
@@ -3,6 +3,10 @@ shared_examples "an employee" do
3
3
  let(:employee) { described_class.new(logger) }
4
4
  let(:completing_job_class) do
5
5
  Class.new do
6
+ def id
7
+ 1
8
+ end
9
+
6
10
  def perform
7
11
  sleep 0.2
8
12
  end
@@ -11,6 +15,10 @@ shared_examples "an employee" do
11
15
  let(:completing_job) { completing_job_class.new}
12
16
  let(:failing_job_class) do
13
17
  Class.new do
18
+ def id
19
+ 2
20
+ end
21
+
14
22
  def perform
15
23
  sleep 0.2
16
24
  raise "Oops"
@@ -18,7 +26,7 @@ shared_examples "an employee" do
18
26
  end
19
27
  end
20
28
  let(:failing_job) { failing_job_class.new}
21
- let(:job) { double("Job") }
29
+ let(:job) { double("Job", id: 3) }
22
30
 
23
31
  describe "#initialize" do
24
32
  it "sets the logger" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: employer
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -135,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  segments:
137
137
  - 0
138
- hash: 2766441661319471233
138
+ hash: 564123794148475375
139
139
  required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  none: false
141
141
  requirements:
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  segments:
146
146
  - 0
147
- hash: 2766441661319471233
147
+ hash: 564123794148475375
148
148
  requirements: []
149
149
  rubyforge_project:
150
150
  rubygems_version: 1.8.23