Sha256: 21e711b68820234c87d5e6fc990d023af807f1cc3520663aa42e3b850ddff4de

Contents?: true

Size: 825 Bytes

Versions: 5

Compression:

Stored size: 825 Bytes

Contents

require "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

5 entries across 5 versions & 1 rubygems

Version Path
scoped_search-2.6.0 spec/unit/query_builder_spec.rb
scoped_search-2.5.1 spec/unit/query_builder_spec.rb
scoped_search-2.5.0 spec/unit/query_builder_spec.rb
scoped_search-2.4.1 spec/unit/query_builder_spec.rb
scoped_search-2.4.0 spec/unit/query_builder_spec.rb