Sha256: 053487b0e4b6bd3c29e8e0882ca3dd9140aaf485c53c89a93b644e4a930cfd82

Contents?: true

Size: 909 Bytes

Versions: 12

Compression:

Stored size: 909 Bytes

Contents

# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias
# Schmidt

require File.expand_path(File.dirname(__FILE__)) + '/unit_helper'

require 'lhm/sql_helper'

describe Lhm::SqlHelper do
  it 'should name index with a single column' do
    value(Lhm::SqlHelper.idx_name(:users, :name))
      .must_equal('index_users_on_name')
  end

  it 'should name index with multiple columns' do
    value(Lhm::SqlHelper.idx_name(:users, [:name, :firstname]))
      .must_equal('index_users_on_name_and_firstname')
  end

  it 'should name index with prefixed column' do
    value(Lhm::SqlHelper.idx_name(:tracks, ['title(10)', 'album']))
      .must_equal('index_tracks_on_title_and_album')
  end

  it 'should quote column names in index specification' do
    value(Lhm::SqlHelper.idx_spec(['title(10)', 'name (6)', 'album']))
      .must_equal('`title`(10), `name`(6), `album`')
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lhm-shopify-4.5.0 spec/unit/sql_helper_spec.rb
lhm-shopify-4.4.2 spec/unit/sql_helper_spec.rb
lhm-shopify-4.4.1 spec/unit/sql_helper_spec.rb
lhm-shopify-4.4.0 spec/unit/sql_helper_spec.rb
lhm-shopify-4.3.0 spec/unit/sql_helper_spec.rb
lhm-shopify-4.2.3 spec/unit/sql_helper_spec.rb
lhm-shopify-4.2.2 spec/unit/sql_helper_spec.rb
lhm-shopify-4.2.1 spec/unit/sql_helper_spec.rb
lhm-shopify-4.2.0 spec/unit/sql_helper_spec.rb
lhm-shopify-4.1.1 spec/unit/sql_helper_spec.rb
lhm-shopify-4.1.0 spec/unit/sql_helper_spec.rb
lhm-shopify-4.0.0 spec/unit/sql_helper_spec.rb