Sha256: d50188afd092508d16890f2c5a36d0eeaa86a1384ebd070e3eda87cffd83bea0

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require_relative "helper"

module Arel
  module FactoryMethods
    class TestFactoryMethods < Arel::Test
      class Factory
        include Arel::FactoryMethods
      end

      def setup
        @factory = Factory.new
      end

      def test_create_join
        join = @factory.create_join :one, :two
        assert_kind_of Nodes::Join, join
        assert_equal :two, join.right
      end

      def test_create_on
        on = @factory.create_on :one
        assert_instance_of Nodes::On, on
        assert_equal :one, on.expr
      end

      def test_create_true
        true_node = @factory.create_true
        assert_instance_of Nodes::True, true_node
      end

      def test_create_false
        false_node = @factory.create_false
        assert_instance_of Nodes::False, false_node
      end

      def test_lower
        lower = @factory.lower :one
        assert_instance_of Nodes::NamedFunction, lower
        assert_equal "LOWER", lower.name
        assert_equal [:one], lower.expressions.map(&:expr)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ibm_db-5.5.0 test/cases/arel/factory_methods_test.rb
ibm_db-5.4.1 test/cases/arel/factory_methods_test.rb
ibm_db-5.4.0 test/cases/arel/factory_methods_test.rb
ibm_db-5.3.2 test/cases/arel/factory_methods_test.rb
ibm_db-5.3.1 test/cases/arel/factory_methods_test.rb