Sha256: f13f49d7e21806e724105b54b77317668dd50ec8a1f8e2213b728cd40c690bc4

Contents?: true

Size: 879 Bytes

Versions: 9

Compression:

Stored size: 879 Bytes

Contents

# Copyright (c) 2011, 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
    Lhm::SqlHelper.
      idx_name(:users, :name).
      must_equal("index_users_on_name")
  end

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

  it "should name index with prefixed column" do
    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
    Lhm::SqlHelper.
      idx_spec(["title(10)", "album"]).
      must_equal("`title`(10), `album`")
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
sbader-lhm-1.1.0 spec/unit/sql_helper_spec.rb
lhm-1.1.0 spec/unit/sql_helper_spec.rb
lhm-1.0.3 spec/unit/sql_helper_spec.rb
lhm-1.0.2 spec/unit/sql_helper_spec.rb
lhm-1.0.0.rc7 spec/unit/sql_helper_spec.rb
lhm-1.0.0.rc6 spec/unit/sql_helper_spec.rb
lhm-1.0.0.rc5 spec/unit/sql_helper_spec.rb
lhm-1.0.0.rc4 spec/unit/sql_helper_spec.rb
lhm-1.0.0.rc3 spec/unit/sql_helper_spec.rb