Sha256: 38ee80ef2ed16288e31dd27d1dcde9573a3f8ed1a037722b3f9f70a319b2f697

Contents?: true

Size: 756 Bytes

Versions: 9

Compression:

Stored size: 756 Bytes

Contents

require "spec_helper"

describe PgSearch::Configuration::Column do
  describe "#full_name" do
    with_model :Model do
      table do |t|
        t.string :name
      end
    end

    it "returns the fully-qualified table and column name" do
      column = described_class.new("name", nil, Model)
      column.full_name.should == %Q{#{Model.quoted_table_name}."name"}
    end
  end

  describe "#to_sql" do
    with_model :Model do
      table do |t|
        t.string :name
      end
    end

    it "returns an expression that casts the column to text and coalesces it with an empty string" do
      column = described_class.new("name", nil, Model)
      column.to_sql.should == %Q{coalesce(#{Model.quoted_table_name}."name"::text, '')}
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pg_search-0.7.4 spec/lib/pg_search/configuration/column_spec.rb
pg_search-0.7.3 spec/lib/pg_search/configuration/column_spec.rb
pg_search-0.7.2 spec/lib/pg_search/configuration/column_spec.rb
pg_search-0.7.1 spec/lib/pg_search/configuration/column_spec.rb
pg_search-0.7.0 spec/lib/pg_search/configuration/column_spec.rb
pg_search-0.6.4 spec/lib/pg_search/configuration/column_spec.rb
pg_search-0.6.3 spec/lib/pg_search/configuration/column_spec.rb
pg_search-0.6.2 spec/lib/pg_search/configuration/column_spec.rb
pg_search-0.6.1 spec/lib/pg_search/configuration/column_spec.rb