Sha256: 0182418f86bd77af2584e8aa215df033136f5acfb95fa3f09a9edcb1079578b5

Contents?: true

Size: 482 Bytes

Versions: 8

Compression:

Stored size: 482 Bytes

Contents

require 'helper'

describe Arel::Nodes::Extract do
  it "should extract field" do
    table = Arel::Table.new :users
    table[:timestamp].extract('date').to_sql.must_be_like %{
      EXTRACT(DATE FROM "users"."timestamp")
    }
  end

  describe "as" do
    it 'should alias the extract' do
      table = Arel::Table.new :users
      table[:timestamp].extract('date').as('foo').to_sql.must_be_like %{
        EXTRACT(DATE FROM "users"."timestamp") AS foo
      }
    end
  end
end

Version data entries

8 entries across 3 versions & 3 rubygems

Version Path
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/arel-3.0.3/test/nodes/test_extract.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/arel-3.0.3/test/nodes/test_extract.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/arel-3.0.3/test/nodes/test_extract.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/arel-3.0.3/test/nodes/test_extract.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/arel-3.0.3/test/nodes/test_extract.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/arel-3.0.3/test/nodes/test_extract.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/arel-3.0.3/test/nodes/test_extract.rb
arel-3.0.3 test/nodes/test_extract.rb