Sha256: 7ae2bf538e04fef51b9688d617833504fd89e8b4dab20504839dc21da9ba78d1

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'
require 'conceptql/nodes/race'

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

  describe '#query' do
    it 'works for white' do
      correct_query = "SELECT * FROM person_with_dates AS p INNER JOIN vocabulary.concept AS vc ON (vc.concept_id = p.race_concept_id) WHERE (lower(vc.concept_name) IN ('white'))"
      ConceptQL::Nodes::Race.new('White').query(Sequel.mock).sql.must_equal correct_query
      ConceptQL::Nodes::Race.new('white').query(Sequel.mock).sql.must_equal correct_query
    end

    it 'works for multiple values' do
      correct_query = "SELECT * FROM person_with_dates AS p INNER JOIN vocabulary.concept AS vc ON (vc.concept_id = p.race_concept_id) WHERE (lower(vc.concept_name) IN ('white', 'other'))"
      ConceptQL::Nodes::Race.new('White', 'Other').query(Sequel.mock).sql.must_equal correct_query
      ConceptQL::Nodes::Race.new('white', 'other').query(Sequel.mock).sql.must_equal correct_query
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
conceptql-0.0.6 spec/conceptql/nodes/race_spec.rb
conceptql-0.0.5 spec/conceptql/nodes/race_spec.rb
conceptql-0.0.4 spec/conceptql/nodes/race_spec.rb
conceptql-0.0.3 spec/conceptql/nodes/race_spec.rb
conceptql-0.0.1 spec/conceptql/nodes/race_spec.rb