diff --git a/core/fiber/storage_spec.rb b/core/fiber/storage_spec.rb index d173da4a3..ce0351927 100644 --- a/core/fiber/storage_spec.rb +++ b/core/fiber/storage_spec.rb @@ -90,6 +90,17 @@ it "returns nil if the current fiber has no storage" do Fiber.new { Fiber[:life] }.resume.should be_nil end + + it "can access the storage of the parent fiber" do + f = Fiber.new(storage: {life: 42}) do + Fiber.new { Fiber[:life] }.resume + end + f.resume.should == 42 + end + + it "can't access the storage of the fiber with non-symbol keys" do + -> { Fiber[Object.new] }.should raise_error(TypeError) + end end end