fiber_scheduler_spec 0.0.2 → 0.9.0

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
  SHA256:
3
- metadata.gz: c1e20ced7c55e6f9566d1a0e802f217e0981be4ab4d2ccbd5c27ac9604e43f7b
4
- data.tar.gz: 5b2234c2a5dee08864e7cbbd27105c9e1b70e610c379afbd74b6c86ab38e2d88
3
+ metadata.gz: bea63eb7f423a7ef93c852d5ffce145a2d05af9a6001a9e361c1c9e2cb28f3f2
4
+ data.tar.gz: 4f798d9b7d7957581589fb2548391bff36c036f9724b8f2a0a086c19398a0314
5
5
  SHA512:
6
- metadata.gz: a7baa25d93db508fb5dde06e91979c30df901b817e5dc878369873c9932af07a0c2be2e4587be3160c1c43e0672e0872470032dc600135585cf6fe9b97200405
7
- data.tar.gz: 20471ba20badf88e691affb068309e7734a67d1f73e9d8d272d6de460040795b1b8e305fb09221908cdcdf9a281d6d066309d56d7f733c4cd126499669c33928
6
+ metadata.gz: f254954f399c78bcc69d8635de1c0df05d8e9ab953feb4667965b86a5e4d3b5be38dc4e33ab451cb2b730e403fe8f163e50af07eaa5f4789b2903e5fe3d035cd
7
+ data.tar.gz: 7545ee8ddc87eeb12677ea46f4cc8e788ad4392b5acdd5c51a854bfcce680cd2294fc3ef4b84a95bb2026a2936d7e517f9babf7e8ad2296a800194bed09b7eba
@@ -25,7 +25,7 @@ RSpec.shared_examples FiberSchedulerSpec::AddressResolve do
25
25
  Fiber.schedule do
26
26
  order << 3
27
27
  Addrinfo.getaddrinfo("example.com", 80, :AF_INET, :STREAM)
28
- order << 6
28
+ order << 5
29
29
  end
30
30
  order << 4
31
31
  end
@@ -41,7 +41,7 @@ RSpec.shared_examples FiberSchedulerSpec::AddressResolve do
41
41
  it "behaves async" do
42
42
  setup
43
43
 
44
- expect(order).to eq (1..6).to_a
44
+ expect(order).to eq [1, 2, 3, 4, 5, 5]
45
45
  end
46
46
  end
47
47
  end
@@ -8,14 +8,10 @@ end
8
8
  RSpec.shared_examples FiberSchedulerSpec::Fiber do
9
9
  include_context FiberSchedulerSpec::Context
10
10
 
11
- context "Fiber.schedule" do
11
+ shared_examples :examples do
12
12
  let(:fibers) { [] }
13
13
  let(:fiber) { fibers.first }
14
14
 
15
- def operations
16
- fibers << Fiber.schedule {}
17
- end
18
-
19
15
  it "calls #fiber" do
20
16
  expect_any_instance_of(scheduler_class)
21
17
  .to receive(:fiber).once
@@ -32,7 +28,7 @@ RSpec.shared_examples FiberSchedulerSpec::Fiber do
32
28
  setup
33
29
  after = ObjectSpace.each_object(Fiber).count
34
30
 
35
- # The after - before is > 1 with the built-in selector.
31
+ # The 'after - before' is > 1 with some selectors.
36
32
  expect(after - before).to be >= 1
37
33
  ensure
38
34
  GC.enable
@@ -45,4 +41,28 @@ RSpec.shared_examples FiberSchedulerSpec::Fiber do
45
41
  expect(fiber).not_to be_blocking
46
42
  end
47
43
  end
44
+
45
+ context "Fiber.schedule with an empty block" do
46
+ def operations
47
+ fibers << Fiber.schedule {}
48
+ end
49
+
50
+ include_examples :examples
51
+ end
52
+
53
+ context "Fiber.schedule with a non-blocking operation" do
54
+ def operations
55
+ fibers << Fiber.schedule { sleep 0 }
56
+ end
57
+
58
+ include_examples :examples
59
+ end
60
+
61
+ context "Fiber.schedule with a blocking operation" do
62
+ def operations
63
+ fibers << Fiber.schedule { "." }
64
+ end
65
+
66
+ include_examples :examples
67
+ end
48
68
  end
@@ -1,3 +1,3 @@
1
1
  module FiberSchedulerSpec
2
- VERSION = "0.0.2"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fiber_scheduler_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Sutic
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: async
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: standard
29
43
  requirement: !ruby/object:Gem::Requirement