Sha256: 3d850f8338ec4ead2893d8b7509134fca0e52a9a71ed317a1336df0294fce939

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true
RSpec.describe Timeful::RelationProxy do
  subject { described_class.new(target) }

  describe '#find_each' do
    context 'when the target responds to #find_each' do
      let(:target) do
        Class.new do
          def find_each
            yield 1
          end
        end.new
      end

      it 'calls #find_each on the target' do
        expect { |block| subject.find_each(&block) }.to yield_with_args(1)
      end
    end

    context 'when the target does not respond to #find_each' do
      let(:target) do
        Class.new do
          def each
            yield 1
          end
        end.new
      end

      it 'calls #each on the target' do
        expect { |block| subject.find_each(&block) }.to yield_with_args(1)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
timeful-2.1.0 spec/timeful/relation_proxy_spec.rb
timeful-2.0.0 spec/timeful/relation_proxy_spec.rb