Sha256: 02db67862588a283117cfd4dd49f27c82d415ee6fdcf72f91ea0cbba87d71e83
Contents?: true
Size: 461 Bytes
Versions: 16
Compression:
Stored size: 461 Bytes
Contents
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_any_instance_of(Array).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
16 entries across 16 versions & 2 rubygems