Sha256: fc0012fe90ebd7fd61ef1eeaaae8e1546342edbdaf955c7b473991ce8b5db5ef

Contents?: true

Size: 854 Bytes

Versions: 7

Compression:

Stored size: 854 Bytes

Contents

require "#{File.dirname(__FILE__)}/../spec_helper"

describe ScopedSearch::QueryBuilder do

  before(:each) do
    @definition = mock('ScopedSearch::Definition')
    @definition.stub!(:klass).and_return(Class.new(ActiveRecord::Base))
    @definition.stub!(:profile).and_return(:default)
    @definition.stub!(:default_order).and_return(nil)
    @definition.stub!(:profile=).and_return(true)
  end

  it "should return empty conditions if the search query is nil" do
    ScopedSearch::QueryBuilder.build_query(@definition, nil).should == { }
  end

  it "should return empty conditions if the query is blank" do
    ScopedSearch::QueryBuilder.build_query(@definition, "").should == { }
  end

  it "should return empty conditions if the query is whitespace only" do
    ScopedSearch::QueryBuilder.build_query(@definition, "\t ").should == {  }
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scoped_search-2.3.7 spec/unit/query_builder_spec.rb
scoped_search-2.3.6 spec/unit/query_builder_spec.rb
scoped_search-2.3.5 spec/unit/query_builder_spec.rb
scoped_search-2.3.4 spec/unit/query_builder_spec.rb
scoped_search-2.3.3 spec/unit/query_builder_spec.rb
scoped_search-2.3.1 spec/unit/query_builder_spec.rb
scoped_search-2.3.0 spec/unit/query_builder_spec.rb