1 require File.dirname(__FILE__) + '/../../spec_helper'
2 require File.dirname(__FILE__) + '/fixtures/classes'
4 describe "Array#push" do
5 it "appends the arguments to the array" do
7 a.push("d", "e", "f").should equal(a)
8 a.push().should == ["a", "b", "c", "d", "e", "f"]
10 a.should == ["a", "b", "c", "d", "e", "f", 5]
13 it "isn't confused by previous shift" do
17 a.should == ["b", "c", "foo"]
20 compliant_on :ruby, :jruby do
21 it "raises a TypeError on a frozen array if modification takes place" do
22 lambda { ArraySpecs.frozen_array.push(1) }.should raise_error(TypeError)
25 it "does not raise on a frozen array if no modification is made" do
26 ArraySpecs.frozen_array.push.should == [1, 2, 3]