spec/unit/veritas/relation/each_spec.rb in veritas-0.0.2 vs spec/unit/veritas/relation/each_spec.rb in veritas-0.0.3

- old
+ new

@@ -1,29 +1,28 @@ require 'spec_helper' -describe 'Veritas::Relation#each' do +describe Relation, '#each' do subject { object.each { |tuple| yields << tuple } } - let(:klass) { Relation } let(:header) { Relation::Header.new([ [ :id, Integer ] ]) } let(:body) { [ [ 1 ], [ 2 ], [ 2 ] ].each } # use an Enumerator - let(:object) { klass.new(header, body) } + let(:object) { described_class.new(header, body) } let(:yields) { [] } before do - object.should be_instance_of(klass) + object.should be_instance_of(described_class) end - it_should_behave_like 'a command method' + it_should_behave_like 'an #each method' it 'yields each tuple' do expect { subject }.to change { yields.dup }. from([]). to([ [ 1 ], [ 2 ] ]) end end -describe 'Veritas::Relation' do +describe Relation do subject { object.new(header, body) } let(:header) { [ [ :id, Integer ] ] } let(:body) { [ [ 1 ] ].each } let(:object) { Relation }