Sha256: 4213483b1bd82426b61467ade4d63b3c0400dd47d60ff7dbb6ff34b4a06dc33b

Contents?: true

Size: 745 Bytes

Versions: 9

Compression:

Stored size: 745 Bytes

Contents

# frozen_string_literal: true

require 'acceptance/spec_helper'

RSpec.describe 'Connections', :live => true do
  let(:maximum)    { (2 ** 23) - 5 }
  let(:query)      { String.new "SELECT * FROM book_core WHERE MATCH('')" }
  let(:difference) { maximum - query.length }

  it 'allows normal length queries through' do
    expect {
      ThinkingSphinx::Connection.take do |connection|
        connection.execute query.insert(-3, 'a' * difference)
      end
    }.to_not raise_error
  end

  it 'does not allow overly long queries' do
    expect {
      ThinkingSphinx::Connection.take do |connection|
        connection.execute query.insert(-3, 'a' * (difference + 5))
      end
    }.to raise_error(ThinkingSphinx::QueryLengthError)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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