Sha256: 79e4866a48e922eeb490e606f12c7f34c603b5fdcbb0f095a4e6a6e26477aaa7

Contents?: true

Size: 667 Bytes

Versions: 4

Compression:

Stored size: 667 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Operation::Order, '#each' do
  subject { object.each { |tuple| yields << tuple } }

  let(:relation)   { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]) }
  let(:directions) { [ relation[:id].desc ]                                      }
  let(:object)     { described_class.new(relation, directions)                   }
  let(:yields)     { []                                                          }

  it_should_behave_like 'an #each method'

  it 'yields each tuple in order' do
    expect { subject }.to change { yields.dup }.
      from([]).
      to([ [ 3 ], [ 2 ], [ 1 ] ])
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-0.0.7 spec/unit/veritas/relation/operation/order/each_spec.rb
veritas-0.0.6 spec/unit/veritas/relation/operation/order/each_spec.rb
veritas-0.0.5 spec/unit/veritas/relation/operation/order/each_spec.rb
veritas-0.0.4 spec/unit/veritas/relation/operation/order/each_spec.rb