File: symbol_as_refinement_spec.rb

package info (click to toggle)
ruby-sequel 5.63.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,408 kB
  • sloc: ruby: 113,747; makefile: 3
file content (21 lines) | stat: -rw-r--r-- 545 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require_relative "spec_helper"

if (RUBY_VERSION >= '2.0.0' && RUBY_ENGINE == 'ruby') || (RUBY_VERSION >= '2.3.0' && RUBY_ENGINE == 'jruby')
Sequel.extension :symbol_as_refinement
using Sequel::SymbolAs

describe "symbol_as_refinement extension" do
  before do
    @db = Sequel.mock
  end

  it "Symbol#as should create aliased expression" do
    @db.literal(:x.as(:y)).must_equal "x AS y"
  end

  it "Symbol#as should create aliased expression with columns" do
    @db.literal(:x.as(:y, [:c1, :c2])).must_equal "x AS y(c1, c2)"
  end
end
end