Sha256: 4472e24e2a0b8a337f96ea18a5e07faa4dbfa8ad13afa949090f04a322966cf1

Contents?: true

Size: 606 Bytes

Versions: 7

Compression:

Stored size: 606 Bytes

Contents

require 'spec_helper'

class ActiveModelUserPhrase < StubModelBase
  ac_field :full_name, :mode => :phrase
end

describe ':phrase mode autocomplete' do
  let(:model) { ActiveModelUserPhrase }
  before :all do
    model.setup_index
  end

  it 'have :phrase mode' do
    model.ac_opts[:mode].should == :phrase
  end

  it_behaves_like 'basic autocomplete', ActiveModelUserPhrase

  it 'don\'t suggest from the middle of the word' do
    model.ac_search('becca').to_a.should be_empty
  end

  it 'don\'t for each word of the source' do
    model.ac_search('Flores').map(&:full_name).should be_empty
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
elasticsearch_autocomplete-0.1.2 spec/elasticsearch_autocomplete/phrase_mode_spec.rb
elasticsearch_autocomplete-0.1.1 spec/elasticsearch_autocomplete/phrase_mode_spec.rb
elasticsearch_autocomplete-0.1.0 spec/elasticsearch_autocomplete/phrase_mode_spec.rb
elasticsearch_autocomplete-0.0.4 spec/elasticsearch_autocomplete/phrase_mode_spec.rb
elasticsearch_autocomplete-0.0.3 spec/elasticsearch_autocomplete/phrase_mode_spec.rb
elasticsearch_autocomplete-0.0.2 spec/elasticsearch_autocomplete/phrase_mode_spec.rb
elasticsearch_autocomplete-0.0.1 spec/elasticsearch_autocomplete/phrase_mode_spec.rb