spec/sequencer_spec.rb in alephant-sequencer-0.0.8 vs spec/sequencer_spec.rb in alephant-sequencer-0.1.0

- old
+ new

@@ -52,10 +52,19 @@ m = double() m.stub(:body) m end + let(:an_uncalled_proc) do + a_block = double() + a_block.should_not_receive(:called).with(message) + + Proc.new do |msg| + a_block.called(msg) + end + end + let(:a_proc) do a_block = double() a_block.should_receive(:called).with(message) Proc.new do |msg| @@ -135,9 +144,22 @@ .any_instance .should_not_receive(:set_last_seen) subject = Alephant::Sequencer::Sequencer.new(sequence_table, ident, jsonpath) subject.sequence(message, &a_proc) + end + + context "keep_all is false" do + let(:keep_all) { false } + it "should not call the passed block with msg" do + subject = Alephant::Sequencer::Sequencer.new( + sequence_table, + ident, + jsonpath, + keep_all + ) + subject.sequence(message, &an_uncalled_proc) + end end end context "last_seen_id < sequence_id_from(msg)" do before(:each) do