/usr/lib/ruby/vendor_ruby/celluloid/rspec/task_examples.rb is in ruby-celluloid 0.16.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | class MockActor
attr_reader :tasks
def initialize
@tasks = []
end
def setup_thread
end
end
shared_context "a Celluloid Task" do |task_class|
let(:task_type) { :foobar }
let(:suspend_state) { :doing_something }
let(:actor) { MockActor.new }
subject { task_class.new(task_type, {}) { Celluloid::Task.suspend(suspend_state) } }
before :each do
Thread.current[:celluloid_actor_system] = Celluloid.actor_system
Thread.current[:celluloid_actor] = actor
end
after :each do
Thread.current[:celluloid_actor] = nil
Thread.current[:celluloid_actor_system] = nil
end
it "begins with status :new" do
expect(subject.status).to be :new
end
it "resumes" do
expect(subject).to be_running
subject.resume
expect(subject.status).to eq(suspend_state)
subject.resume
expect(subject).not_to be_running
end
it "raises exceptions outside" do
task = task_class.new(task_type, {}) do
raise "failure"
end
expect do
task.resume
end.to raise_exception("failure")
end
end
|