celluloid_pubsub 1.1.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,6 +1,12 @@
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'
@@ -16,6 +22,7 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(formatters)
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,17 +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
- celluloid_running = Celluloid.running? rescue false
57
- Celluloid.boot unless celluloid_running
58
- 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: {})
59
123
 
60
124
  unless defined?(silence_stream) # Rails 5
61
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.1.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: 2017-03-22 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
@@ -204,26 +206,6 @@ dependencies:
204
206
  - - ">="
205
207
  - !ruby/object:Gem::Version
206
208
  version: 0.0.5
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.2'
214
- - - ">="
215
- - !ruby/object:Gem::Version
216
- version: '1.2'
217
- type: :development
218
- prerelease: false
219
- version_requirements: !ruby/object:Gem::Requirement
220
- requirements:
221
- - - "~>"
222
- - !ruby/object:Gem::Version
223
- version: '1.2'
224
- - - ">="
225
- - !ruby/object:Gem::Version
226
- version: '1.2'
227
209
  - !ruby/object:Gem::Dependency
228
210
  name: coveralls
229
211
  requirement: !ruby/object:Gem::Requirement
@@ -262,22 +244,16 @@ dependencies:
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
@@ -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,13 +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
366
- - gemfiles/celluloid_0.18.0.pre.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
367
346
  - init.rb
368
347
  - lib/celluloid_pubsub.rb
369
348
  - lib/celluloid_pubsub/base_actor.rb
370
349
  - lib/celluloid_pubsub/client.rb
350
+ - lib/celluloid_pubsub/client_connection.rb
371
351
  - lib/celluloid_pubsub/gem_version_parser.rb
372
352
  - lib/celluloid_pubsub/helper.rb
373
353
  - lib/celluloid_pubsub/initializers/reel_colors.rb
@@ -375,9 +355,11 @@ files:
375
355
  - lib/celluloid_pubsub/registry.rb
376
356
  - lib/celluloid_pubsub/version.rb
377
357
  - lib/celluloid_pubsub/web_server.rb
358
+ - spec/lib/celluloid_pubsub/base_actor_spec.rb
378
359
  - spec/lib/celluloid_pubsub/client_pubsub_spec.rb
379
360
  - spec/lib/celluloid_pubsub/reactor_spec.rb
380
361
  - spec/lib/celluloid_pubsub/registry_spec.rb
362
+ - spec/lib/celluloid_pubsub/version_spec.rb
381
363
  - spec/lib/celluloid_pubsub/web_server_spec.rb
382
364
  - spec/spec_helper.rb
383
365
  homepage: http://github.com/bogdanRada/celluloid_pubsub/
@@ -399,11 +381,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
399
381
  - !ruby/object:Gem::Version
400
382
  version: '0'
401
383
  requirements: []
402
- rubyforge_project:
403
- rubygems_version: 2.6.8
384
+ rubygems_version: 3.1.2
404
385
  signing_key:
405
386
  specification_version: 4
406
387
  summary: CelluloidPubsub is a simple ruby implementation of publish subscribe design
407
388
  patterns using celluloid actors and websockets, using Celluloid::Reel server
408
389
  test_files: []
409
- has_rdoc: