Sha256: 5a34282cf97f0605668e05e1a0eb3af37f743203baf92456183c3914d61e6c6f

Contents?: true

Size: 1.13 KB

Versions: 16

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

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

    before :each do
      allow(ThinkingSphinx::Search).to receive_messages :new => search
    end

    it "returns the total entries of the search object" do
      expect(ThinkingSphinx.count).to eq(search.total_entries)
    end

    it "passes through the given query and options" do
      expect(ThinkingSphinx::Search).to 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
      allow(ThinkingSphinx::Search).to receive_messages :new => search
    end

    it "returns a new search object" do
      expect(ThinkingSphinx.search).to eq(search)
    end

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

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
thinking-sphinx-5.5.1 spec/thinking_sphinx_spec.rb
thinking-sphinx-5.5.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-5.4.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-5.3.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-5.2.1 spec/thinking_sphinx_spec.rb
thinking-sphinx-5.2.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-5.1.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-5.0.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-4.4.1 spec/thinking_sphinx_spec.rb
thinking-sphinx-4.4.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-4.3.2 spec/thinking_sphinx_spec.rb
thinking-sphinx-4.3.1 spec/thinking_sphinx_spec.rb
thinking-sphinx-4.3.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-4.2.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-4.1.0 spec/thinking_sphinx_spec.rb
thinking-sphinx-4.0.0 spec/thinking_sphinx_spec.rb