summaryrefslogtreecommitdiff
path: root/spec/ruby/core/thread/group_spec.rb
blob: d0d4704b66fe49c89ac04a72c33e90d932b4c4a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require_relative '../../spec_helper'

describe "Thread#group" do
  it "returns the default thread group for the main thread" do
    Thread.main.group.should == ThreadGroup::Default
  end

  it "returns the thread group explicitly set for this thread" do
    thread = Thread.new { nil }
    thread_group = ThreadGroup.new
    thread_group.add(thread)
    thread.group.should == thread_group
  ensure
    thread.join if thread
  end
end