File: butlast_spec.rb

package info (click to toggle)
ruby-powerpack 0.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 492 kB
  • sloc: ruby: 819; makefile: 3
file content (13 lines) | stat: -rw-r--r-- 294 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'spec_helper'

unless Array.method_defined? :butlast
  describe 'Array#butlast' do
    it 'returns an array without the last element' do
      expect([1, 2, 3].butlast).to eq([1, 2])
    end

    it 'returns [] for empty lists' do
      expect([].butlast).to be_empty
    end
  end
end