Sha256: 311d81ba37c842e56a637e44247453305fd8f8fc75d1cb292c92d82716547b1a

Contents?: true

Size: 886 Bytes

Versions: 13

Compression:

Stored size: 886 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)', 'album']))
      .must_equal('`title`(10), `album`')
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
lhm-teak-3.6.4 spec/unit/sql_helper_spec.rb
lhm-teak-3.6.3 spec/unit/sql_helper_spec.rb
lhm-teak-3.6.2 spec/unit/sql_helper_spec.rb
lhm-teak-3.6.1 spec/unit/sql_helper_spec.rb
lhm-teak-3.6.0 spec/unit/sql_helper_spec.rb
lhm-shopify-3.5.5 spec/unit/sql_helper_spec.rb
lhm-shopify-3.5.4 spec/unit/sql_helper_spec.rb
lhm-shopify-3.5.3 spec/unit/sql_helper_spec.rb
lhm-shopify-3.5.2 spec/unit/sql_helper_spec.rb
lhm-shopify-3.5.0 spec/unit/sql_helper_spec.rb
lhm-shopify-3.5.1 spec/unit/sql_helper_spec.rb
lhm-shopify-3.4.2 spec/unit/sql_helper_spec.rb
lhm-shopify-3.4.1 spec/unit/sql_helper_spec.rb