Sha256: e1fbec3765c75d03d643a6252779e13bf99015a3f6ef93814af09e5c85bd7d74

Contents?: true

Size: 676 Bytes

Versions: 1

Compression:

Stored size: 676 Bytes

Contents

require "spec_helper"

describe TFG::Support::Sequence do
  subject(:sequence) { TFG::Support::Sequence.new(first, generator) }

  describe "#next" do
    let(:first) { Object.new }
    let(:second) { Object.new }
    let(:generator) { double("generator", call: second) }

    subject(:call) { sequence.next }

    context "on the first call" do
      specify { expect(call).to eq first }
      specify { call; expect(generator).to_not have_received(:call) }
    end

    context "on susequent calls" do
      before { sequence.next }

      specify { expect(call).to eq second }
      specify { call; expect(generator).to have_received(:call).with(first) }
    end
  end
end 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tfg_support-1.0.0 spec/tfg/support/sequence_spec.rb