Sha256: ca3b07ba4bd0995a20a9d961f5108357e2186113131113c1cb47be36b0ea9f50

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require 'test_helper'

class QueryParserTest < ActionController::TestCase

  include QueryParser

  test "should extract basic prefixed scoped query" do
    full_query = 'scope:scrc libraries'
    
    query = extracted_query(full_query)
    assert_equal('libraries', query)

    scope = extracted_scope(full_query)
    assert_equal('scrc', scope)
  end

  test "should extract basic suffixed scoped query" do
    full_query = 'libraries scope:scrc'
    
    query = extracted_query(full_query)
    assert_equal('libraries', query)

    scope = extracted_scope(full_query)
    assert_equal('scrc', scope)
  end

  test "should extract compound prefixed scoped query" do
    full_query = 'scope:(scrc OR jobs) libraries'
    
    query = extracted_query(full_query)
    assert_equal('libraries', query)

    scope = extracted_scope(full_query)
    assert_equal('scrc OR jobs', scope)
  end

  test "should extract compound suffixed scoped query" do
    full_query = 'libraries scope:(scrc OR jobs)'
    
    query = extracted_query(full_query)
    assert_equal('libraries', query)

    scope = extracted_scope(full_query)
    assert_equal('scrc OR jobs', scope)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
quick_search-core-0.0.1 test/controllers/concerns/query_parser_test.rb
quick_search-core-0.0.1.test test/controllers/concerns/query_parser_test.rb