Sha256: 88277ec39781dc373ba34408e4eb6afd16247dfcc148b8e75c9e4b7a8a1520cf

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

require "spec_helper"
require "dionysus/array/assert_types"

describe Array do
  subject { [1, Object.new, "foo"] }

  describe "#assert_types" do
    it { subject.assert_types(Integer, Object, String).should be_true }

    it "should require matching lengths" do
      expect { subject.assert_types(Symbol) }.
        to raise_error(ArgumentError, "Number of arguments must match length of Array")
    end

    it "should require matching types" do
      expect { subject.assert_types(Integer, Object, Symbol) }.
        to raise_error(ArgumentError, "Value at index 2 expected to be a Symbol")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dionysus-2.2.0.0.pre1 spec/lib/array/assert_types_spec.rb