Sha256: 33dfe7f41a6c164c2eec4ff70cbfd513f483a697e840cbaf10fdf5bacb083caa

Contents?: true

Size: 950 Bytes

Versions: 8

Compression:

Stored size: 950 Bytes

Contents

# frozen_string_literal: true

require 'acceptance/spec_helper'

describe 'Updates to records in real-time indices', :live => true do
  it "handles fields with unicode nulls" do
    product = Product.create! :name => "Widget \u0000"

    expect(Product.search.first).to eq(product)
  end unless ENV['DATABASE'] == 'postgresql'

  it "handles attributes for sortable fields accordingly" do
    product = Product.create! :name => 'Red Fish'
    product.update_attributes :name => 'Blue Fish'

    expect(Product.search('blue fish', :indices => ['product_core']).to_a).
      to eq([product])
  end

  it "handles inserts and updates for namespaced models" do
    person = Admin::Person.create :name => 'Death'

    expect(Admin::Person.search('Death').to_a).to eq([person])

    person.update_attributes :name => 'Mort'

    expect(Admin::Person.search('Death').to_a).to be_empty
    expect(Admin::Person.search('Mort').to_a).to eq([person])
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
thinking-sphinx-4.4.1 spec/acceptance/real_time_updates_spec.rb
thinking-sphinx-4.4.0 spec/acceptance/real_time_updates_spec.rb
thinking-sphinx-4.3.2 spec/acceptance/real_time_updates_spec.rb
thinking-sphinx-4.3.1 spec/acceptance/real_time_updates_spec.rb
thinking-sphinx-4.3.0 spec/acceptance/real_time_updates_spec.rb
thinking-sphinx-4.2.0 spec/acceptance/real_time_updates_spec.rb
thinking-sphinx-4.1.0 spec/acceptance/real_time_updates_spec.rb
thinking-sphinx-4.0.0 spec/acceptance/real_time_updates_spec.rb