kontext 0.1.0 → 0.1.1
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.
- data/lib/kontext.rb +1 -1
- data/lib/kontext/version.rb +1 -1
- data/spec/kontext_spec.rb +30 -16
- metadata +4 -4
data/lib/kontext.rb
CHANGED
data/lib/kontext/version.rb
CHANGED
data/spec/kontext_spec.rb
CHANGED
@@ -3,8 +3,14 @@ require "kontext"
|
|
3
3
|
|
4
4
|
describe Kontext do
|
5
5
|
describe Kontext::RootFiber do
|
6
|
-
|
7
|
-
|
6
|
+
if defined? Fiber
|
7
|
+
it "is a reference to the root fiber" do
|
8
|
+
Kontext::RootFiber.should equal(Fiber.current)
|
9
|
+
end
|
10
|
+
else
|
11
|
+
it "is nil (Ruby 1.8 == no fibers)" do
|
12
|
+
Kontext::RootFiber.should be_nil
|
13
|
+
end
|
8
14
|
end
|
9
15
|
end
|
10
16
|
|
@@ -27,27 +33,35 @@ describe Kontext do
|
|
27
33
|
end
|
28
34
|
|
29
35
|
describe "#fiber?" do
|
30
|
-
|
31
|
-
|
32
|
-
|
36
|
+
if defined? Fiber
|
37
|
+
it "returns true if the current fiber is not the root fiber" do
|
38
|
+
result = nil
|
39
|
+
Fiber.new { result = kontext.fiber? }.resume
|
33
40
|
|
34
|
-
|
35
|
-
|
41
|
+
result.should be_true
|
42
|
+
end
|
36
43
|
|
37
|
-
|
38
|
-
|
44
|
+
it "returns false if we're in the root fiber" do
|
45
|
+
kontext.fiber?.should be_false
|
46
|
+
end
|
47
|
+
else
|
48
|
+
it "returns nil (Ruby 1.8 == no fibers)" do
|
49
|
+
kontext.fiber?.should be_nil
|
50
|
+
end
|
39
51
|
end
|
40
52
|
end
|
41
53
|
|
42
54
|
describe "#store" do
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
55
|
+
if defined? Fiber
|
56
|
+
describe "when in a fiber" do
|
57
|
+
before do
|
58
|
+
kontext.stub :fiber? => true, :thread? => false
|
59
|
+
end
|
47
60
|
|
48
|
-
|
49
|
-
|
50
|
-
|
61
|
+
it "returns a fiber specific store" do
|
62
|
+
key = Fiber.current.object_id.to_s
|
63
|
+
kontext.store.should equal(Thread.current[key])
|
64
|
+
end
|
51
65
|
end
|
52
66
|
end
|
53
67
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kontext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
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: 2012-02-
|
12
|
+
date: 2012-02-21 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &82117410 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *82117410
|
25
25
|
description: Thread and Fiber specific global state
|
26
26
|
email:
|
27
27
|
- lars.gierth@gmail.com
|