Skip to content

Commit

Permalink
Add tests for Fiber#storage access from other fibers
Browse files Browse the repository at this point in the history
  • Loading branch information
herwinw committed Aug 27, 2023
1 parent 821cc08 commit fa4c9f4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/fiber/storage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
end
end

describe "Fiber#storage" do
ruby_version_is "3.2" do
it "cannot be accessed from a different fiber" do
f = Fiber.new(storage: {life: 42}) { nil }
-> {
f.storage
}.should raise_error(ArgumentError, /Fiber storage can only be accessed from the Fiber it belongs to/)
end
end
end

describe "Fiber#storage=" do
ruby_version_is "3.2" do
it "can clear the storage of the fiber" do
Expand Down

0 comments on commit fa4c9f4

Please sign in to comment.