aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/thread/initialize_spec.rb
blob: b6345f03de2a34efaad7731f6d6075de4e4c8d85 (plain)
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
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

describe "Thread#initialize" do

  describe "already initialized" do

    before do
      @t = Thread.new { sleep }
    end

    after do
      @t.kill
      @t.join
    end

    it "raises a ThreadError" do
      lambda {
        @t.instance_eval do
          initialize {}
        end
      }.should raise_error(ThreadError)
    end

  end

end