Sha256: 896fd807a00708dc445e6b96a946867446ef4863106cf087e2ad17690b2d8d5c

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'helper'

module Arel
  module FactoryMethods
    class TestFactoryMethods < Minitest::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

2 entries across 2 versions & 1 rubygems

Version Path
arel-6.0.0.beta2 test/test_factory_methods.rb
arel-6.0.0.beta1 test/test_factory_methods.rb