cloudist 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,39 +3,39 @@ require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
3
3
  describe Cloudist::Request do
4
4
  before {
5
5
  @mq_header = mock("MQ::Header")
6
- @mq_header.stubs(:headers).returns({:published_on=>Time.now.to_i - 60, :event_hash=>"foo", :message_id=>"foo", :ttl=>300})
7
-
6
+ @mq_header.stub(:headers).and_return({:published_on=>Time.now.to_i - 60, :event_hash=>"foo", :message_id=>"foo", :ttl=>300})
7
+
8
8
  q = Cloudist::JobQueue.new('test.queue')
9
-
9
+
10
10
  @request = Cloudist::Request.new(q, Marshal.dump({:bread => 'white'}), @mq_header)
11
11
  }
12
-
12
+
13
13
  it "should return ttl" do
14
14
  @request.ttl.should == 300
15
15
  end
16
-
16
+
17
17
  it "should have a payload" do
18
18
  @request.payload.should_not be_nil
19
19
  @request.payload.should be_a(Cloudist::Payload)
20
20
  end
21
-
21
+
22
22
  it "should be 1 minute old" do
23
23
  @request.age.should == 60
24
24
  end
25
-
25
+
26
26
  it "should not be expired" do
27
27
  @request.expired?.should_not be_true
28
28
  end
29
-
29
+
30
30
  it "should not be acked yet" do
31
31
  @request.acked?.should be_false
32
32
  end
33
-
33
+
34
34
  it "should be ackable" do
35
- @mq_header.stubs(:ack).returns(true)
36
-
35
+ @mq_header.stub(:ack).and_return(true)
36
+
37
37
  @request.ack.should be_true
38
38
  @request.acked?.should be_true
39
39
  end
40
-
41
- end
40
+
41
+ end
@@ -4,15 +4,15 @@ describe Cloudist::Utils do
4
4
  it "should return reply queue name" do
5
5
  Cloudist::Utils.reply_prefix('eat.sandwich').should == 'temp.reply.eat.sandwich'
6
6
  end
7
-
7
+
8
8
  it "should return log queue name" do
9
9
  Cloudist::Utils.log_prefix('eat.sandwich').should == 'temp.log.eat.sandwich'
10
10
  end
11
-
11
+
12
12
  it "should return stats queue name" do
13
13
  Cloudist::Utils.stats_prefix('eat.sandwich').should == 'temp.stats.eat.sandwich'
14
14
  end
15
-
15
+
16
16
  # it "should generate queue name" do
17
17
  # Cloudist::Utils.generate_queue('test').should == ''
18
18
  # end
@@ -6,47 +6,47 @@ describe "Cloudist" do
6
6
  stub_amqp!
7
7
  end
8
8
  it "should start an AMQP instance" do
9
- AMQP.expects(:start).once
10
-
9
+ AMQP.should_receive(:start).once
10
+
11
11
  Cloudist.start do
12
-
12
+
13
13
  end
14
14
  end
15
-
15
+
16
16
  # before(:each) do
17
17
  # overload_amqp
18
18
  # reset_broker
19
19
  # Cloudist.remove_workers
20
- #
20
+ #
21
21
  # @mq = mock("MQ")
22
22
  # @queue, @exchange = mock_queue_and_exchange('make.sandwich')
23
- #
23
+ #
24
24
  # @qobj = Cloudist::JobQueue.any_instance
25
25
  # @qobj.stubs(:q).returns(@queue)
26
26
  # @qobj.stubs(:mq).returns(@mq)
27
27
  # @qobj.stubs(:ex).returns(@exchange)
28
28
  # @qobj.stubs(:setup)
29
29
  # end
30
- #
30
+ #
31
31
  # it "should register a worker" do
32
32
  # Cloudist.register_worker('make.sandwich', SandwichWorker)
33
33
  # Cloudist.workers.should have_key("make.sandwich")
34
34
  # Cloudist.workers["make.sandwich"].size.should == 1
35
35
  # end
36
- #
36
+ #
37
37
  # it "should support handle syntax" do
38
38
  # Cloudist.workers.should == {}
39
39
  # Cloudist.handle('make.sandwich').with(SandwichWorker)
40
40
  # Cloudist.workers.should have_key("make.sandwich")
41
41
  # Cloudist.workers["make.sandwich"].size.should == 1
42
42
  # end
43
- #
43
+ #
44
44
  # # it "should support handle syntax with multiple queues" do
45
45
  # # Cloudist.workers.should == {}
46
46
  # # Cloudist.handle('make.sandwich', 'eat.sandwich').with(SandwichWorker)
47
47
  # # # Cloudist.workers.should == {"make.sandwich"=>[SandwichWorker], "eat.sandwich"=>[SandwichWorker]}
48
48
  # # end
49
- #
49
+ #
50
50
  # it "should call process on worker when job arrives" do
51
51
  # job = Cloudist.enqueue('make.sandwich', {:bread => 'white'})
52
52
  # job.payload.published?.should be_true
@@ -55,5 +55,5 @@ describe "Cloudist" do
55
55
  # Cloudist.workers.should have_key("make.sandwich")
56
56
  # Cloudist.workers["make.sandwich"].size.should == 1
57
57
  # end
58
-
58
+
59
59
  end
@@ -7,10 +7,10 @@ describe "String" do
7
7
  "started!".ends_with?('!').should be_true
8
8
  "started!".ends_with?('-').should be_false
9
9
  end
10
-
10
+
11
11
  it "should support starts_with?" do
12
12
  "event-started".starts_with?("event").should be_true
13
13
  "event-started".starts_with?("reply").should be_false
14
14
  end
15
-
16
- end
15
+
16
+ end
@@ -2,7 +2,6 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
  require 'rspec'
4
4
  require "moqueue"
5
- require "mocha"
6
5
  require 'cloudist'
7
6
 
8
7
  # Requires supporting files with custom matchers and macros, etc,
@@ -10,5 +9,5 @@ require 'cloudist'
10
9
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
11
10
 
12
11
  RSpec.configure do |config|
13
- config.mock_with :mocha
12
+ config.mock_with :rspec
14
13
  end
@@ -1,16 +1,16 @@
1
1
  def stub_amqp!
2
- AMQP.stubs(:start)
2
+ AMQP.stub(:start)
3
3
  mock_queue = mock("AMQP::Queue")
4
- mock_queue.stubs(:bind)
5
- mock_queue.stubs(:name).returns("test.queue")
6
-
4
+ mock_queue.stub(:bind)
5
+ mock_queue.stub(:name).and_return("test.queue")
6
+
7
7
  mock_ex = mock("AMQP::Exchange")
8
- mock_ex.stubs(:name).returns("test.queue")
9
-
8
+ mock_ex.stub(:name).and_return("test.queue")
9
+
10
10
  mock_channel = mock("AMQP::Channel")
11
- mock_channel.stubs(:prefetch).with(1)
12
- mock_channel.stubs(:queue).returns(mock_queue)
13
- mock_channel.stubs(:direct).returns(mock_ex)
14
-
15
- AMQP::Channel.stubs(:new).returns(mock_channel)
11
+ mock_channel.stub(:prefetch).with(1)
12
+ mock_channel.stub(:queue).and_return(mock_queue)
13
+ mock_channel.stub(:direct).and_return(mock_ex)
14
+
15
+ AMQP::Channel.stub(:new).and_return(mock_channel)
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-08 00:00:00.000000000 Z
12
+ date: 2012-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: amqp
16
- requirement: &70283600180020 !ruby/object:Gem::Requirement
16
+ requirement: &70159864997720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,21 +21,21 @@ dependencies:
21
21
  version: 0.8.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70283600180020
24
+ version_requirements: *70159864997720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70283600176880 !ruby/object:Gem::Requirement
27
+ requirement: &70159864997240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 1.4.6
32
+ version: '1.4'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70283600176880
35
+ version_requirements: *70159864997240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: i18n
38
- requirement: &70283600173880 !ruby/object:Gem::Requirement
38
+ requirement: &70159864996760 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,21 +43,21 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70283600173880
46
+ version_requirements: *70159864996760
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activesupport
49
- requirement: &70283600172180 !ruby/object:Gem::Requirement
49
+ requirement: &70159865012640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
- - - ~>
52
+ - - ! '>'
53
53
  - !ruby/object:Gem::Version
54
- version: 3.0.3
54
+ version: 3.0.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70283600172180
57
+ version_requirements: *70159865012640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hashie
60
- requirement: &70283600202000 !ruby/object:Gem::Requirement
60
+ requirement: &70159865012160 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70283600202000
68
+ version_requirements: *70159865012160
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: uuid
71
- requirement: &70283600200920 !ruby/object:Gem::Requirement
71
+ requirement: &70159865011680 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,21 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70283600200920
80
- - !ruby/object:Gem::Dependency
81
- name: rake
82
- requirement: &70283600200220 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ~>
86
- - !ruby/object:Gem::Version
87
- version: 0.9.2
88
- type: :development
89
- prerelease: false
90
- version_requirements: *70283600200220
79
+ version_requirements: *70159865011680
91
80
  - !ruby/object:Gem::Dependency
92
81
  name: rspec
93
- requirement: &70283600199320 !ruby/object:Gem::Requirement
82
+ requirement: &70159865011200 !ruby/object:Gem::Requirement
94
83
  none: false
95
84
  requirements:
96
85
  - - ~>
@@ -98,21 +87,10 @@ dependencies:
98
87
  version: 2.4.0
99
88
  type: :development
100
89
  prerelease: false
101
- version_requirements: *70283600199320
90
+ version_requirements: *70159865011200
102
91
  - !ruby/object:Gem::Dependency
103
92
  name: moqueue
104
- requirement: &70283600198460 !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- type: :development
111
- prerelease: false
112
- version_requirements: *70283600198460
113
- - !ruby/object:Gem::Dependency
114
- name: mocha
115
- requirement: &70283600197500 !ruby/object:Gem::Requirement
93
+ requirement: &70159865010720 !ruby/object:Gem::Requirement
116
94
  none: false
117
95
  requirements:
118
96
  - - ! '>='
@@ -120,21 +98,10 @@ dependencies:
120
98
  version: '0'
121
99
  type: :development
122
100
  prerelease: false
123
- version_requirements: *70283600197500
124
- - !ruby/object:Gem::Dependency
125
- name: bundler
126
- requirement: &70283600196860 !ruby/object:Gem::Requirement
127
- none: false
128
- requirements:
129
- - - ~>
130
- - !ruby/object:Gem::Version
131
- version: 1.0.0
132
- type: :development
133
- prerelease: false
134
- version_requirements: *70283600196860
101
+ version_requirements: *70159865010720
135
102
  - !ruby/object:Gem::Dependency
136
103
  name: jeweler
137
- requirement: &70283600196200 !ruby/object:Gem::Requirement
104
+ requirement: &70159865010240 !ruby/object:Gem::Requirement
138
105
  none: false
139
106
  requirements:
140
107
  - - ~>
@@ -142,21 +109,10 @@ dependencies:
142
109
  version: 1.6.4
143
110
  type: :development
144
111
  prerelease: false
145
- version_requirements: *70283600196200
146
- - !ruby/object:Gem::Dependency
147
- name: rcov
148
- requirement: &70283600195440 !ruby/object:Gem::Requirement
149
- none: false
150
- requirements:
151
- - - ! '>='
152
- - !ruby/object:Gem::Version
153
- version: '0'
154
- type: :development
155
- prerelease: false
156
- version_requirements: *70283600195440
112
+ version_requirements: *70159865010240
157
113
  - !ruby/object:Gem::Dependency
158
114
  name: reek
159
- requirement: &70283600194860 !ruby/object:Gem::Requirement
115
+ requirement: &70159865009760 !ruby/object:Gem::Requirement
160
116
  none: false
161
117
  requirements:
162
118
  - - ~>
@@ -164,10 +120,10 @@ dependencies:
164
120
  version: 1.2.8
165
121
  type: :development
166
122
  prerelease: false
167
- version_requirements: *70283600194860
123
+ version_requirements: *70159865009760
168
124
  - !ruby/object:Gem::Dependency
169
125
  name: roodi
170
- requirement: &70283600231360 !ruby/object:Gem::Requirement
126
+ requirement: &70159865009280 !ruby/object:Gem::Requirement
171
127
  none: false
172
128
  requirements:
173
129
  - - ~>
@@ -175,7 +131,7 @@ dependencies:
175
131
  version: 2.1.0
176
132
  type: :development
177
133
  prerelease: false
178
- version_requirements: *70283600231360
134
+ version_requirements: *70159865009280
179
135
  description: Cloudist is a simple, highly scalable job queue for Ruby applications,
180
136
  it can run within Rails, DaemonKit or your own custom application. Refer to github
181
137
  page for examples
@@ -258,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
214
  version: '0'
259
215
  segments:
260
216
  - 0
261
- hash: 1919465750267067991
217
+ hash: 3917515305809132007
262
218
  required_rubygems_version: !ruby/object:Gem::Requirement
263
219
  none: false
264
220
  requirements:
@@ -267,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
223
  version: '0'
268
224
  requirements: []
269
225
  rubyforge_project:
270
- rubygems_version: 1.8.10
226
+ rubygems_version: 1.8.15
271
227
  signing_key:
272
228
  specification_version: 3
273
229
  summary: Super fast job queue using AMQP