Sha256: 569cd5a73f39732e13720cd101762c85d1869412b00ccd49523c7f1c03d2cca5

Contents?: true

Size: 883 Bytes

Versions: 10

Compression:

Stored size: 883 Bytes

Contents

require 'spec_helper'
require 'conceptql/nodes/last'
require_double('stream_for_occurrence')

describe ConceptQL::Nodes::Last do
  it 'behaves itself' do
    ConceptQL::Nodes::Last.new.must_behave_like(:evaluator)
  end

  it 'should have occurrence pegged at -1' do
    ConceptQL::Nodes::Last.new.occurrence.must_equal(-1)
  end

  describe 'occurrence set to -1' do
    subject do
      ConceptQL::Nodes::Last.new(StreamForOccurrenceDouble.new).query(Sequel.mock).sql
    end


    it 'should order by descending start_date' do
      subject.must_match 'ORDER BY start_date DESC'
    end

    it 'should partition by person_id' do
      subject.must_match 'PARTITION BY person_id'
    end

    it 'should assign a row number' do
      subject.must_match 'row_number()'
    end

    it 'should find the all rows with rn = 1' do
      subject.must_match 'rn = 1'
    end
  end
end


Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
conceptql-0.1.1 spec/conceptql/nodes/last_spec.rb
conceptql-0.1.0 spec/conceptql/nodes/last_spec.rb
conceptql-0.0.9 spec/conceptql/nodes/last_spec.rb
conceptql-0.0.8 spec/conceptql/nodes/last_spec.rb
conceptql-0.0.7 spec/conceptql/nodes/last_spec.rb
conceptql-0.0.6 spec/conceptql/nodes/last_spec.rb
conceptql-0.0.5 spec/conceptql/nodes/last_spec.rb
conceptql-0.0.4 spec/conceptql/nodes/last_spec.rb
conceptql-0.0.3 spec/conceptql/nodes/last_spec.rb
conceptql-0.0.1 spec/conceptql/nodes/last_spec.rb