Sha256: b5bfea10f07f424e1574807b6da5e56345b5a41c3ac84844882883c3dffe8357

Contents?: true

Size: 721 Bytes

Versions: 11

Compression:

Stored size: 721 Bytes

Contents

require 'minitest_helper'

describe 'NQL::ComputedAttributes' do

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

  def parse(expression)
    parser.parse expression
  end

  it 'must have one computed attributes' do
    tree = parse 'notice = any notice'

    tree.computed_attributes(Posts).must_equal [:notice]
  end

  it 'must have multiple computed attributes' do
    tree = parse 'notice = any notice & (author: anonym | title = good morning)'

    tree.computed_attributes(Posts).must_equal [:notice, :author]
  end

  it 'must have not repeated computed attributes when expression have it' do
    tree = parse 'notice = Hi | notice = Bye'

    tree.computed_attributes(Posts).must_equal [:notice]
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rasti-db-4.2.0 spec/nql/computed_attributes_spec.rb
rasti-db-4.1.1 spec/nql/computed_attributes_spec.rb
rasti-db-4.1.0 spec/nql/computed_attributes_spec.rb
rasti-db-4.0.0 spec/nql/computed_attributes_spec.rb
rasti-db-3.0.0 spec/nql/computed_attributes_spec.rb
rasti-db-2.3.3 spec/nql/computed_attributes_spec.rb
rasti-db-2.3.2 spec/nql/computed_attributes_spec.rb
rasti-db-2.3.1 spec/nql/computed_attributes_spec.rb
rasti-db-2.3.0 spec/nql/computed_attributes_spec.rb
rasti-db-2.2.0 spec/nql/computed_attributes_spec.rb
rasti-db-2.1.0 spec/nql/computed_attributes_spec.rb