Sha256: a38e2d0a986cfb8766f390a6ed94ccd7097cff928a74c38c002553ca68deab71
Contents?: true
Size: 487 Bytes
Versions: 2
Compression:
Stored size: 487 Bytes
Contents
# frozen_string_literal: true shared_examples 'a method that returns a random element' do |method| let(:array) { [7, 5, 3] } (0..2).each do |index| context "when random returns #{index}" do let!(:expected) { array[index] } before do allow(Random).to receive(:rand) .with(array.size) { index } end it 'returns the randomized index of the array' do expect(array.public_send(method)).to eq(expected) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
darthjee-core_ext-2.0.0 | spec/support/shared_examples/array/array_random.rb |
darthjee-core_ext-1.7.4 | spec/support/shared_examples/array/array_random.rb |