Sha256: 529cb06a00eda941ef66c66364a718fef7bc88cf367d12e489e3d6fc60fd9531

Contents?: true

Size: 1023 Bytes

Versions: 14

Compression:

Stored size: 1023 Bytes

Contents

require 'spec_helper'

describe ThinkingSphinx do
  describe '.count' do
    let(:search) { double('search', :total_entries => 23) }

    before :each do
      ThinkingSphinx::Search.stub :new => search
    end

    it "returns the total entries of the search object" do
      ThinkingSphinx.count.should == search.total_entries
    end

    it "passes through the given query and options" do
      ThinkingSphinx::Search.should_receive(:new).with('foo', :bar => :baz).
        and_return(search)

      ThinkingSphinx.count('foo', :bar => :baz)
    end
  end

  describe '.search' do
    let(:search) { double('search') }

    before :each do
      ThinkingSphinx::Search.stub :new => search
    end

    it "returns a new search object" do
      ThinkingSphinx.search.should == search
    end

    it "passes through the given query and options" do
      ThinkingSphinx::Search.should_receive(:new).with('foo', :bar => :baz).
        and_return(search)

      ThinkingSphinx.search('foo', :bar => :baz)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
thinking-sphinx-3.1.4 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.1.3 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.1.2 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.1.1 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.1.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.0.6 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.0.5 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.0.4 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.0.3 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.0.2 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.0.1 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.0.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-3.0.0.rc spec/thinking_sphinx_spec.rb
thinking-sphinx-3.0.0.pre spec/thinking_sphinx_spec.rb