Sha256: 926a060400c35a19ec2ffcf040de35f61ca7d374aeec4fbd19673ce9b384d2c1

Contents?: true

Size: 459 Bytes

Versions: 1

Compression:

Stored size: 459 Bytes

Contents

# encoding: utf-8

require_relative "../../../lib/rango/ext/array"

describe Array do
  describe "#only" do
    it "should returns the only item in array" do
      [:first].only.should eql(:first)
    end

    it "should raise index error if array has more items" do
      -> { [1, 2].only }.should raise_error(IndexError)
    end

    it "should returns the only item in array" do
      -> { Array.new.only }.should raise_error(IndexError)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rango-0.0.4 spec/rango/ext/array_spec.rb