Sha256: 42ed69146145f560e09139d143abe653bf9240302a35ce5246bad46134a5dad6

Contents?: true

Size: 1.04 KB

Versions: 10

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'
require 'conceptql/nodes/during'
require_double('stream_for_temporal')

describe ConceptQL::Nodes::During do
  it 'behaves itself' do
    ConceptQL::Nodes::During.new.must_behave_like(:temporal_node)
  end

  describe 'when not inclusive' do
    subject do
      ConceptQL::Nodes::During.new(left: StreamForTemporalDouble.new, right: StreamForTemporalDouble.new)
    end

    it 'should use proper where clause' do
      subject.query(Sequel.mock).sql.must_match 'l.end_date <= r.end_date'
      subject.query(Sequel.mock).sql.must_match 'r.start_date <= l.start_date'
    end
  end

  describe 'when inclusive' do
    subject do
      ConceptQL::Nodes::During.new(left: StreamForTemporalDouble.new, right: StreamForTemporalDouble.new, inclusive: true)
    end

    it 'should use proper where clause' do
      subject.query(Sequel.mock).sql.must_match '(r.start_date <= l.end_date) AND (l.end_date <= r.end_date)'
      subject.query(Sequel.mock).sql.must_match '(r.start_date <= l.start_date) AND (l.start_date <= r.end_date)'
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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