Sha256: 425f50ee23fdbc869030054ebf3b846bd776b5339b8cb9028645c94efc7c98d5

Contents?: true

Size: 823 Bytes

Versions: 9

Compression:

Stored size: 823 Bytes

Contents

require "spec_helper"

describe ScopedSearch::QueryBuilder do

  before(:each) do
    @definition = double('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

9 entries across 9 versions & 1 rubygems

Version Path
scoped_search-3.0.1 spec/unit/query_builder_spec.rb
scoped_search-3.0.0 spec/unit/query_builder_spec.rb
scoped_search-2.7.1 spec/unit/query_builder_spec.rb
scoped_search-2.7.0 spec/unit/query_builder_spec.rb
scoped_search-2.6.5 spec/unit/query_builder_spec.rb
scoped_search-2.6.4 spec/unit/query_builder_spec.rb
scoped_search-2.6.3 spec/unit/query_builder_spec.rb
scoped_search-2.6.2 spec/unit/query_builder_spec.rb
scoped_search-2.6.1 spec/unit/query_builder_spec.rb