describe "Something" do it "should mock a call to an array" do odontogram = mock("odontogram") photos = mock("photos") odontogram.stub!(:photos).and_return(photos) photos.should_receive(:[]).with(1).and_return("Some Value") odontogram.photos[1] end end