celluloid_pubsub 1.0.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,8 +3,26 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe CelluloidPubsub::Registry do
6
- it 'has class atributes' do
6
+ before(:each) do
7
+ CelluloidPubsub::Registry.channels = []
8
+ CelluloidPubsub::Registry.messages = {}
9
+ end
10
+
11
+ it 'has class attribute channels' do
7
12
  act = CelluloidPubsub::Registry.respond_to?(:channels)
8
13
  expect(act).to eq true
9
14
  end
15
+
16
+ it 'defaults to empty array for channels' do
17
+ expect(CelluloidPubsub::Registry.channels).to eq([])
18
+ end
19
+
20
+ it 'has class attribute messages' do
21
+ act = CelluloidPubsub::Registry.respond_to?(:messages)
22
+ expect(act).to eq true
23
+ end
24
+
25
+ it 'defaults to empty hash for messages' do
26
+ expect(CelluloidPubsub::Registry.messages).to eq({})
27
+ end
10
28
  end
@@ -0,0 +1,21 @@
1
+ # encoding:utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CelluloidPubsub do
6
+ it 'returns the string' do
7
+ expected = [
8
+ CelluloidPubsub::VERSION::MAJOR,
9
+ CelluloidPubsub::VERSION::MINOR,
10
+ CelluloidPubsub::VERSION::TINY,
11
+ CelluloidPubsub::VERSION::PRE
12
+ ].compact.join('.')
13
+ expect(CelluloidPubsub::VERSION::STRING).to eq(expected)
14
+ end
15
+
16
+ it 'returns the gem version' do
17
+ expected = 'something'
18
+ expect(::Gem::Version).to receive(:new).with(CelluloidPubsub::VERSION::STRING).and_return(expected)
19
+ expect(CelluloidPubsub.gem_version).to eq(expected)
20
+ end
21
+ end
@@ -11,10 +11,10 @@ describe CelluloidPubsub::WebServer do
11
11
  expect(CelluloidPubsub::WebServer::PATH).to eq('/ws')
12
12
  end
13
13
  let(:options) { {} }
14
- let(:web_server) { mock }
14
+ let(:web_server) { double }
15
15
 
16
16
  before(:each) do
17
- CelluloidPubsub::WebServer.stubs(:new).returns(web_server)
17
+ allow(CelluloidPubsub::WebServer).to receive(:new).and_return(web_server)
18
18
  end
19
19
 
20
20
  # it '#initialize with default values ' do
data/spec/spec_helper.rb CHANGED
@@ -1,21 +1,28 @@
1
1
  # Configure Rails Envinronment
2
2
  ENV['RAILS_ENV'] = 'test'
3
-
3
+ ENV['RACK_ENV'] = 'test'
4
+ ENV['APP_ENV'] = 'test'
5
+ require 'bundler/setup'
6
+ require 'rspec'
7
+ require 'rspec/expectations'
8
+ require 'rspec/mocks'
9
+ require 'rspec/support'
4
10
  require 'simplecov'
5
11
  require 'simplecov-summary'
6
12
  require 'coveralls'
7
13
 
8
14
  # require "codeclimate-test-reporter"
9
- formatters = [SimpleCov::Formatter::HTMLFormatter]
15
+ formatters = [SimpleCov::Formatter::SummaryFormatter, SimpleCov::Formatter::HTMLFormatter]
10
16
 
11
17
  formatters << Coveralls::SimpleCov::Formatter # if ENV['TRAVIS']
12
18
  # formatters << CodeClimate::TestReporter::Formatter # if ENV['CODECLIMATE_REPO_TOKEN'] && ENV['TRAVIS']
13
19
 
14
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[*formatters]
20
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(formatters)
15
21
 
16
22
  Coveralls.wear!
17
23
  SimpleCov.start 'rails' do
18
24
  add_filter 'spec'
25
+ add_filter 'lib/celluloid_pubsub/version'
19
26
 
20
27
  at_exit {}
21
28
  end
@@ -24,15 +31,52 @@ end
24
31
  # config.logger.level = Logger::WARN
25
32
  # end
26
33
  # CodeClimate::TestReporter.start
27
-
28
- require 'bundler/setup'
29
34
  require 'celluloid_pubsub'
35
+ require 'logger'
36
+ Celluloid.task_class = if defined?(Celluloid::TaskThread)
37
+ Celluloid::TaskThread
38
+ else
39
+ Celluloid::Task::Threaded
40
+ end
41
+ Celluloid.logger = ::Logger.new(STDOUT)
42
+
43
+ def celluloid_running?
44
+ begin
45
+ Celluloid.running?
46
+ rescue StandardError
47
+ false
48
+ end
49
+ end
30
50
 
31
51
  RSpec.configure do |config|
32
- require 'rspec/expectations'
33
52
  config.include RSpec::Matchers
34
53
 
35
- config.mock_with :mocha
54
+ # assertion/expectation library such as wrong or the stdlib/minitest
55
+ # assertions if you prefer.
56
+ config.expect_with :rspec do |expectations|
57
+ # This option will default to `true` in RSpec 4. It makes the `description`
58
+ # and `failure_message` of custom matchers include text for helper methods
59
+ # defined using `chain`, e.g.:
60
+ # be_bigger_than(2).and_smaller_than(4).description
61
+ # # => "be bigger than 2 and smaller than 4"
62
+ # ...rather than:
63
+ # # => "be bigger than 2"
64
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
65
+ end
66
+
67
+ config.mock_with :rspec do |mocks|
68
+ # Prevents you from mocking or stubbing a method that does not exist on
69
+ # a real object. This is generally recommended, and will default to
70
+ # `true` in RSpec 4.
71
+ mocks.verify_partial_doubles = true
72
+ end
73
+
74
+ config.around(:each) do |example|
75
+ Celluloid.shutdown if celluloid_running?
76
+ Celluloid.boot
77
+ example.run
78
+ Celluloid.shutdown if celluloid_running?
79
+ end
36
80
 
37
81
  config.after(:suite) do
38
82
  if SimpleCov.running
@@ -45,16 +89,37 @@ RSpec.configure do |config|
45
89
  end
46
90
  end
47
91
 
92
+ def example_addr; '127.0.0.1'; end
93
+ def example_port; 1234; end
94
+ def example_path; "/example"; end
95
+ def example_url; "http://#{example_addr}:#{example_port}#{example_path}"; end
96
+
97
+ def with_socket_pair
98
+ logfile = File.open(File.expand_path('../log/test.log', __dir__), 'a')
99
+ server = CelluloidPubsub::WebServer.new(
100
+ hostname: example_addr,
101
+ port: example_port,
102
+ path: example_path,
103
+ enable_debug: true,
104
+ spy: true,
105
+ backlog: 1024,
106
+ adapter: nil,
107
+ log_file_path: logfile,
108
+ log_level: ::Logger::Severity::DEBUG
109
+ )
110
+ yield server
111
+ ensure
112
+ server.terminate if server && server.alive?
113
+ end
48
114
 
49
115
  # class used for testing actions
50
116
  class TestActor
51
117
  include CelluloidPubsub::BaseActor
52
118
 
53
- def initialize(*_args)
54
- end
119
+ def initialize(*_args); end
55
120
  end
56
-
57
- CelluloidPubsub::BaseActor.setup_actor_supervision(TestActor, actor_name: :test_actor, args: { })
121
+ CelluloidPubsub::BaseActor.boot_up
122
+ CelluloidPubsub::BaseActor.setup_actor_supervision(TestActor, actor_name: :test_actor, args: {})
58
123
 
59
124
  unless defined?(silence_stream) # Rails 5
60
125
  def silence_stream(stream)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celluloid_pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-26 00:00:00.000000000 Z
11
+ date: 2021-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 0.16.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: celluloid-fsm
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: celluloid-io
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -54,20 +68,14 @@ dependencies:
54
68
  name: reel
55
69
  requirement: !ruby/object:Gem::Requirement
56
70
  requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '0.6'
60
- - - ">="
71
+ - - '='
61
72
  - !ruby/object:Gem::Version
62
73
  version: 0.6.0
63
74
  type: :runtime
64
75
  prerelease: false
65
76
  version_requirements: !ruby/object:Gem::Requirement
66
77
  requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '0.6'
70
- - - ">="
78
+ - - '='
71
79
  - !ruby/object:Gem::Version
72
80
  version: 0.6.0
73
81
  - !ruby/object:Gem::Dependency
@@ -96,20 +104,14 @@ dependencies:
96
104
  requirements:
97
105
  - - "~>"
98
106
  - !ruby/object:Gem::Version
99
- version: '0.2'
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: 0.2.2
107
+ version: '1.0'
103
108
  type: :runtime
104
109
  prerelease: false
105
110
  version_requirements: !ruby/object:Gem::Requirement
106
111
  requirements:
107
112
  - - "~>"
108
113
  - !ruby/object:Gem::Version
109
- version: '0.2'
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: 0.2.2
114
+ version: '1.0'
113
115
  - !ruby/object:Gem::Dependency
114
116
  name: activesupport
115
117
  requirement: !ruby/object:Gem::Requirement
@@ -150,194 +152,168 @@ dependencies:
150
152
  requirements:
151
153
  - - "~>"
152
154
  - !ruby/object:Gem::Version
153
- version: '3.4'
155
+ version: '3.5'
154
156
  - - ">="
155
157
  - !ruby/object:Gem::Version
156
- version: '3.4'
158
+ version: '3.5'
157
159
  type: :development
158
160
  prerelease: false
159
161
  version_requirements: !ruby/object:Gem::Requirement
160
162
  requirements:
161
163
  - - "~>"
162
164
  - !ruby/object:Gem::Version
163
- version: '3.4'
165
+ version: '3.5'
164
166
  - - ">="
165
167
  - !ruby/object:Gem::Version
166
- version: '3.4'
168
+ version: '3.5'
167
169
  - !ruby/object:Gem::Dependency
168
170
  name: simplecov
169
171
  requirement: !ruby/object:Gem::Requirement
170
172
  requirements:
171
173
  - - "~>"
172
174
  - !ruby/object:Gem::Version
173
- version: '0.10'
175
+ version: '0.12'
174
176
  - - ">="
175
177
  - !ruby/object:Gem::Version
176
- version: '0.10'
178
+ version: '0.12'
177
179
  type: :development
178
180
  prerelease: false
179
181
  version_requirements: !ruby/object:Gem::Requirement
180
182
  requirements:
181
183
  - - "~>"
182
184
  - !ruby/object:Gem::Version
183
- version: '0.10'
185
+ version: '0.12'
184
186
  - - ">="
185
187
  - !ruby/object:Gem::Version
186
- version: '0.10'
188
+ version: '0.12'
187
189
  - !ruby/object:Gem::Dependency
188
190
  name: simplecov-summary
189
191
  requirement: !ruby/object:Gem::Requirement
190
192
  requirements:
191
193
  - - "~>"
192
194
  - !ruby/object:Gem::Version
193
- version: 0.0.4
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- version: 0.0.4
197
- type: :development
198
- prerelease: false
199
- version_requirements: !ruby/object:Gem::Requirement
200
- requirements:
201
- - - "~>"
202
- - !ruby/object:Gem::Version
203
- version: 0.0.4
204
- - - ">="
205
- - !ruby/object:Gem::Version
206
- version: 0.0.4
207
- - !ruby/object:Gem::Dependency
208
- name: mocha
209
- requirement: !ruby/object:Gem::Requirement
210
- requirements:
211
- - - "~>"
212
- - !ruby/object:Gem::Version
213
- version: '1.1'
195
+ version: '0.0'
214
196
  - - ">="
215
197
  - !ruby/object:Gem::Version
216
- version: '1.1'
198
+ version: 0.0.5
217
199
  type: :development
218
200
  prerelease: false
219
201
  version_requirements: !ruby/object:Gem::Requirement
220
202
  requirements:
221
203
  - - "~>"
222
204
  - !ruby/object:Gem::Version
223
- version: '1.1'
205
+ version: '0.0'
224
206
  - - ">="
225
207
  - !ruby/object:Gem::Version
226
- version: '1.1'
208
+ version: 0.0.5
227
209
  - !ruby/object:Gem::Dependency
228
210
  name: coveralls
229
211
  requirement: !ruby/object:Gem::Requirement
230
212
  requirements:
231
213
  - - "~>"
232
214
  - !ruby/object:Gem::Version
233
- version: '0.7'
215
+ version: '0.8'
234
216
  - - ">="
235
217
  - !ruby/object:Gem::Version
236
- version: '0.7'
218
+ version: '0.8'
237
219
  type: :development
238
220
  prerelease: false
239
221
  version_requirements: !ruby/object:Gem::Requirement
240
222
  requirements:
241
223
  - - "~>"
242
224
  - !ruby/object:Gem::Version
243
- version: '0.7'
225
+ version: '0.8'
244
226
  - - ">="
245
227
  - !ruby/object:Gem::Version
246
- version: '0.7'
228
+ version: '0.8'
247
229
  - !ruby/object:Gem::Dependency
248
230
  name: rake
249
231
  requirement: !ruby/object:Gem::Requirement
250
232
  requirements:
251
233
  - - ">="
252
234
  - !ruby/object:Gem::Version
253
- version: '10.5'
235
+ version: '12.0'
254
236
  type: :development
255
237
  prerelease: false
256
238
  version_requirements: !ruby/object:Gem::Requirement
257
239
  requirements:
258
240
  - - ">="
259
241
  - !ruby/object:Gem::Version
260
- version: '10.5'
242
+ version: '12.0'
261
243
  - !ruby/object:Gem::Dependency
262
244
  name: yard
263
245
  requirement: !ruby/object:Gem::Requirement
264
246
  requirements:
265
- - - "~>"
266
- - !ruby/object:Gem::Version
267
- version: '0.8'
268
247
  - - ">="
269
248
  - !ruby/object:Gem::Version
270
- version: 0.8.7
249
+ version: 0.9.20
271
250
  type: :development
272
251
  prerelease: false
273
252
  version_requirements: !ruby/object:Gem::Requirement
274
253
  requirements:
275
- - - "~>"
276
- - !ruby/object:Gem::Version
277
- version: '0.8'
278
254
  - - ">="
279
255
  - !ruby/object:Gem::Version
280
- version: 0.8.7
256
+ version: 0.9.20
281
257
  - !ruby/object:Gem::Dependency
282
258
  name: redcarpet
283
259
  requirement: !ruby/object:Gem::Requirement
284
260
  requirements:
285
261
  - - "~>"
286
262
  - !ruby/object:Gem::Version
287
- version: '3.3'
263
+ version: '3.4'
288
264
  - - ">="
289
265
  - !ruby/object:Gem::Version
290
- version: '3.3'
266
+ version: '3.4'
291
267
  type: :development
292
268
  prerelease: false
293
269
  version_requirements: !ruby/object:Gem::Requirement
294
270
  requirements:
295
271
  - - "~>"
296
272
  - !ruby/object:Gem::Version
297
- version: '3.3'
273
+ version: '3.4'
298
274
  - - ">="
299
275
  - !ruby/object:Gem::Version
300
- version: '3.3'
276
+ version: '3.4'
301
277
  - !ruby/object:Gem::Dependency
302
278
  name: github-markup
303
279
  requirement: !ruby/object:Gem::Requirement
304
280
  requirements:
305
281
  - - "~>"
306
282
  - !ruby/object:Gem::Version
307
- version: '1.3'
283
+ version: '1.4'
308
284
  - - ">="
309
285
  - !ruby/object:Gem::Version
310
- version: 1.3.3
286
+ version: '1.4'
311
287
  type: :development
312
288
  prerelease: false
313
289
  version_requirements: !ruby/object:Gem::Requirement
314
290
  requirements:
315
291
  - - "~>"
316
292
  - !ruby/object:Gem::Version
317
- version: '1.3'
293
+ version: '1.4'
318
294
  - - ">="
319
295
  - !ruby/object:Gem::Version
320
- version: 1.3.3
296
+ version: '1.4'
321
297
  - !ruby/object:Gem::Dependency
322
298
  name: inch
323
299
  requirement: !ruby/object:Gem::Requirement
324
300
  requirements:
325
301
  - - "~>"
326
302
  - !ruby/object:Gem::Version
327
- version: '0.6'
303
+ version: '0.7'
328
304
  - - ">="
329
305
  - !ruby/object:Gem::Version
330
- version: '0.6'
306
+ version: '0.7'
331
307
  type: :development
332
308
  prerelease: false
333
309
  version_requirements: !ruby/object:Gem::Requirement
334
310
  requirements:
335
311
  - - "~>"
336
312
  - !ruby/object:Gem::Version
337
- version: '0.6'
313
+ version: '0.7'
338
314
  - - ">="
339
315
  - !ruby/object:Gem::Version
340
- version: '0.6'
316
+ version: '0.7'
341
317
  description: CelluloidPubsub is a simple ruby implementation of publish subscribe
342
318
  design patterns using celluloid actors and websockets, using Reel server for inter-process
343
319
  communication
@@ -349,9 +325,11 @@ files:
349
325
  - ".codeclimate.yml"
350
326
  - ".coveralls.yml"
351
327
  - ".gitignore"
328
+ - ".hound.yml"
352
329
  - ".reek"
353
330
  - ".rspec"
354
331
  - ".rubocop.yml"
332
+ - ".rubocop_todo.yml"
355
333
  - ".travis.yml"
356
334
  - Appraisals
357
335
  - CONTRIBUTING.md
@@ -361,12 +339,15 @@ files:
361
339
  - Rakefile
362
340
  - celluloid_pubsub.gemspec
363
341
  - examples/simple_test.rb
364
- - gemfiles/celluloid_0.16.0.gemfile
365
- - gemfiles/celluloid_0.17.3.gemfile
342
+ - gemfiles/cell_0.16.0.gemfile
343
+ - gemfiles/cell_0.17.3.gemfile
344
+ - gemfiles/cell_0.17.4.gemfile
345
+ - gemfiles/cell_0.18.0.gemfile
366
346
  - init.rb
367
347
  - lib/celluloid_pubsub.rb
368
348
  - lib/celluloid_pubsub/base_actor.rb
369
349
  - lib/celluloid_pubsub/client.rb
350
+ - lib/celluloid_pubsub/client_connection.rb
370
351
  - lib/celluloid_pubsub/gem_version_parser.rb
371
352
  - lib/celluloid_pubsub/helper.rb
372
353
  - lib/celluloid_pubsub/initializers/reel_colors.rb
@@ -374,9 +355,11 @@ files:
374
355
  - lib/celluloid_pubsub/registry.rb
375
356
  - lib/celluloid_pubsub/version.rb
376
357
  - lib/celluloid_pubsub/web_server.rb
358
+ - spec/lib/celluloid_pubsub/base_actor_spec.rb
377
359
  - spec/lib/celluloid_pubsub/client_pubsub_spec.rb
378
360
  - spec/lib/celluloid_pubsub/reactor_spec.rb
379
361
  - spec/lib/celluloid_pubsub/registry_spec.rb
362
+ - spec/lib/celluloid_pubsub/version_spec.rb
380
363
  - spec/lib/celluloid_pubsub/web_server_spec.rb
381
364
  - spec/spec_helper.rb
382
365
  homepage: http://github.com/bogdanRada/celluloid_pubsub/
@@ -398,11 +381,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
398
381
  - !ruby/object:Gem::Version
399
382
  version: '0'
400
383
  requirements: []
401
- rubyforge_project:
402
- rubygems_version: 2.5.1
384
+ rubygems_version: 3.1.2
403
385
  signing_key:
404
386
  specification_version: 4
405
387
  summary: CelluloidPubsub is a simple ruby implementation of publish subscribe design
406
388
  patterns using celluloid actors and websockets, using Celluloid::Reel server
407
389
  test_files: []
408
- has_rdoc: