Sha256: c6e0c54d8fb2b82b9cd0a23037b5831da2dd69cfc44deef4d2615b666aeaa44d

Contents?: true

Size: 882 Bytes

Versions: 3

Compression:

Stored size: 882 Bytes

Contents

require 'spec_helper'
require 'conceptql/nodes/complement'
require_relative 'query_double'

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

  it 'generates complement for single criteria' do
    double1 = QueryDouble.new(1)
    double1.must_behave_like(:evaluator)
    ConceptQL::Nodes::Complement.new(double1).query(Sequel.mock).sql.must_equal "SELECT * FROM (SELECT person_id AS person_id, visit_occurrence_id AS criterion_id, CAST('visit_occurrence' AS varchar(255)) AS criterion_type, CAST(visit_start_date AS date) AS start_date, CAST(visit_end_date AS date) AS end_date FROM visit_occurrence AS tab WHERE (visit_occurrence_id NOT IN (SELECT criterion_id FROM (SELECT * FROM table1) AS t1 WHERE ((criterion_id IS NOT NULL) AND (criterion_type = 'visit_occurrence'))))) AS t1"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
conceptql-0.0.9 spec/conceptql/nodes/complement_spec.rb
conceptql-0.0.8 spec/conceptql/nodes/complement_spec.rb
conceptql-0.0.7 spec/conceptql/nodes/complement_spec.rb