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..3ba54be46b --- /dev/null +++ b/spec/ruby/core/array/frozen_spec.rb @@ -0,0 +1,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 |
