Sha256: f1bba2e12d6afed30f6094f87a733cc97bea635167fef319ae225603d81eb27b
Contents?: true
Size: 691 Bytes
Versions: 6
Compression:
Stored size: 691 Bytes
Contents
RSpec.describe Mutant::Util, '.one' do let(:first) { instance_double(Object) } let(:array) { instance_double(Array, one?: true, first: first) } it 'returns first element' do expect(described_class.one(array)).to be(first) end it 'fails if the list is empty' do expect { described_class.one([]) } .to raise_error(described_class::SizeError) .with_message('expected size to be exactly 1 but size was 0') end it 'fails if the list has more than one element' do expect { described_class.one([1, 2]) } .to raise_error(described_class::SizeError) .with_message('expected size to be exactly 1 but size was 2') end end
Version data entries
6 entries across 6 versions & 1 rubygems