Sha256: 580db5694682df8485c33e21fa5493e5d8b39ec52c330c610d50b4ddcd0babd4

Contents?: true

Size: 809 Bytes

Versions: 18

Compression:

Stored size: 809 Bytes

Contents

require 'minitest_helper'

describe 'NQL::DepedencyTables' do

  let(:parser) { Rasti::DB::NQL::SyntaxParser.new }

  def parse(expression)
    parser.parse expression
  end

  it 'must have no dependency tables' do
    tree = parse 'column = 1'

    tree.dependency_tables.must_be_empty
  end

  it 'must have one dependency table' do
    tree = parse 'relation_table_one.relation_table_two.column = 1'

    tree.dependency_tables.must_equal ['relation_table_one.relation_table_two']
  end

  it 'must have multiple dependency tables' do
    tree = parse 'a.b.c = 1 & (d.e: 2 | f.g.h = 1) | i = 4'

    tree.dependency_tables.must_equal ['a.b', 'd', 'f.g']
  end

  it 'must have repeated sub-dependency' do
    tree = parse 'a.b.c = 1 & a.d: 2'

    tree.dependency_tables.must_equal ['a.b', 'a']
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rasti-db-4.2.0 spec/nql/dependency_tables_spec.rb
rasti-db-4.1.1 spec/nql/dependency_tables_spec.rb
rasti-db-4.1.0 spec/nql/dependency_tables_spec.rb
rasti-db-4.0.0 spec/nql/dependency_tables_spec.rb
rasti-db-3.0.0 spec/nql/dependency_tables_spec.rb
rasti-db-2.3.3 spec/nql/dependency_tables_spec.rb
rasti-db-2.3.2 spec/nql/dependency_tables_spec.rb
rasti-db-2.3.1 spec/nql/dependency_tables_spec.rb
rasti-db-2.3.0 spec/nql/dependency_tables_spec.rb
rasti-db-2.2.0 spec/nql/dependency_tables_spec.rb
rasti-db-2.1.0 spec/nql/dependency_tables_spec.rb
rasti-db-2.0.1 spec/nql/dependency_tables_spec.rb
rasti-db-2.0.0 spec/nql/dependency_tables_spec.rb
rasti-db-1.5.0 spec/nql/dependency_tables_spec.rb
rasti-db-1.4.0 spec/nql/dependency_tables_spec.rb
rasti-db-1.3.1 spec/nql/dependency_tables_spec.rb
rasti-db-1.3.0 spec/nql/dependency_tables_spec.rb
rasti-db-1.2.0 spec/nql/dependency_tables_spec.rb