Sha256: 4d04247f22ca6854cf58c81d2fbdb87c19f0ebc9346d7beb4035661cd038c809

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 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 raise an ArgumentError if the query is not set" do
    lambda { ScopedSearch::QueryBuilder.build_query(@definition, nil) }.should raise_error(ArgumentError)
  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

4 entries across 4 versions & 1 rubygems

Version Path
scoped_search-3.2.2 spec/unit/query_builder_spec.rb
scoped_search-3.2.1 spec/unit/query_builder_spec.rb
scoped_search-3.2.0 spec/unit/query_builder_spec.rb
scoped_search-3.1.0 spec/unit/query_builder_spec.rb