kontext 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/kontext.rb CHANGED
@@ -3,7 +3,7 @@ require "kontext/version"
3
3
  begin
4
4
  require "fiber"
5
5
  rescue LoadError => ex
6
- raise(ex) if ex.message =~ "fiber"
6
+ raise(ex) unless ex.message =~ /fiber/
7
7
  end
8
8
 
9
9
  class Kontext
@@ -1,3 +1,3 @@
1
1
  class Kontext
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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
- it "is a reference to the root fiber" do
7
- Kontext::RootFiber.should equal(Fiber.current)
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
- it "returns true if the current fiber is not the root fiber" do
31
- result = nil
32
- Fiber.new { result = kontext.fiber? }.resume
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
- result.should be_true
35
- end
41
+ result.should be_true
42
+ end
36
43
 
37
- it "returns false if we're in the root fiber" do
38
- kontext.fiber?.should be_false
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
- describe "when in a fiber" do
44
- before do
45
- kontext.stub :fiber? => true, :thread? => false
46
- end
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
- it "returns a fiber specific store" do
49
- key = Fiber.current.object_id.to_s
50
- kontext.store.should equal(Thread.current[key])
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.0
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-20 00:00:00.000000000Z
12
+ date: 2012-02-21 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &85309510 !ruby/object:Gem::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: *85309510
24
+ version_requirements: *82117410
25
25
  description: Thread and Fiber specific global state
26
26
  email:
27
27
  - lars.gierth@gmail.com