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

describe "Array#frozen?" do
  it "returns true if array is frozen" do
    a = [1, 2, 3]
    a.should_not.frozen?
    a.freeze
    a.should.frozen?
  end

  it "returns false for an array being sorted by #sort" do
    a = [1, 2, 3]
    a.sort { |x,y| a.should_not.frozen?; x <=> y }
  end
end