Sha256: 5cf6893a71c0ee6c0232f1fe6de3d8a7a4f3d02bd51433b1e648bed5f7d55013

Contents?: true

Size: 714 Bytes

Versions: 3

Compression:

Stored size: 714 Bytes

Contents

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

3 entries across 3 versions & 1 rubygems

Version Path
thinking-sphinx-3.4.2 spec/acceptance/connection_spec.rb
thinking-sphinx-3.4.1 spec/acceptance/connection_spec.rb
thinking-sphinx-3.4.0 spec/acceptance/connection_spec.rb