Sha256: 60039fe16b304146603f04e821a03e3308f2634dcc03d94c94b8d603912e5d09
Contents?: true
Size: 1.8 KB
Versions: 2
Compression:
Stored size: 1.8 KB
Contents
require 'spec_helper' require 'commute/core/sequence' describe Commute::Sequence do let(:sequence) { Commute::Sequence.new(:test) } it 'should have a name' do sequence.name.must_equal :test end describe '#new' do it 'should be empty' do sequence.size.must_equal 0 end it 'should alter the sequence when a block is provided' do Commute::Sequence.new(:test) { |s| s.append proc {} }.size.must_equal 1 Commute::Sequence.new(:test) { append proc {} append proc {} }.size.must_equal 2 end end describe '#alter' do it 'should alter the sequence in a block when the arity is 1' do sequence.alter { |s| s.append proc {} }.size.must_equal 1 end it 'should evaluate the block when the arity is 0' do sequence.alter { append proc {} }.size.must_equal 1 end end describe '#append' do it 'should append the processor to the tail' do layer1 = sequence.append proc {} sequence.must_equal [layer1] layer2 = sequence.append proc {} sequence.must_equal [layer1, layer2] end it 'should be able to append after a specified processor' do layer1 = sequence.append proc {}, as: :action1 layer3 = sequence.append proc {} layer2 = sequence.append proc {}, as: :action2, after: :action1 sequence.must_equal [layer1, layer2, layer3] end end describe '#remove' do before do @layer1 = sequence.append proc {} @layer2 = sequence.append proc {}, as: :action end it 'should remove the processor if its id is given' do sequence.remove(:action).must_equal @layer2 sequence.must_equal [@layer1] end end describe '#call' do it 'should lazily push the sequence on the path' do skip end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
commute-0.3.0.pre.2 | spec/commute/core/sequence_spec.rb |
commute-0.3.0.pre | spec/commute/core/sequence_spec.rb |