Sha256: 285aea99ccae6040144fefa802ddd556d970250fcb1a71822c127750fdef8f59
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
require "spec_helper" describe TFG::Support::Sequence do context 'created with a generator' 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(:next_call) { sequence.next } context "on the first call to next" do specify { should eq first } end context "on subsequent calls to next" do before { sequence.next } specify { should eq second } end end end context 'created with a block' do subject(:sequence) { TFG::Support::Sequence.new(1) { |arg| arg * 2 } } describe '#next' do subject(:next_call) { sequence.next } context "on the first call to next" do specify { should eq 1 } end context "on the 2nd call to next" do before { sequence.next } specify { should eq 2 } end context "on the 3rd call to next" do before { sequence.next; sequence.next } specify { should eq 4 } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tfg_support-1.1.1 | spec/tfg/support/sequence_spec.rb |
tfg_support-1.0.1 | spec/tfg/support/sequence_spec.rb |