diff options
Diffstat (limited to 'spec/ruby/core/array/frozen_spec.rb')
-rw-r--r-- | spec/ruby/core/array/frozen_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/ruby/core/array/frozen_spec.rb b/spec/ruby/core/array/frozen_spec.rb new file mode 100644 index 0000000000..6c8384f5f7 --- /dev/null +++ b/spec/ruby/core/array/frozen_spec.rb @@ -0,0 +1,16 @@ +require File.expand_path('../../../spec_helper', __FILE__) +require File.expand_path('../fixtures/classes', __FILE__) + +describe "Array#frozen?" do + it "returns true if array is frozen" do + a = [1, 2, 3] + a.frozen?.should == false + a.freeze + a.frozen?.should == true + end + + it "returns false for an array being sorted by #sort" do + a = [1, 2, 3] + a.sort { |x,y| a.frozen?.should == false; x <=> y } + end +end |