Sha256: 5d1a502b8399879c23d56275f2ad5e0a40004433888602ba8da6dd1924dead47

Contents?: true

Size: 1.82 KB

Versions: 123

Compression:

Stored size: 1.82 KB

Contents

require 'helper'

module Arel
  module Visitors
    class TestDot < MiniTest::Unit::TestCase
      def setup
        @visitor = Visitors::Dot.new
      end

      # functions
      [
        Nodes::Sum,
        Nodes::Exists,
        Nodes::Max,
        Nodes::Min,
        Nodes::Avg,
      ].each do |klass|
        define_method("test_#{klass.name.gsub('::', '_')}") do
          op = klass.new(:a, "z")
          @visitor.accept op
        end
      end

      def test_named_function
        func = Nodes::NamedFunction.new 'omg', 'omg'
        @visitor.accept func
      end

      # unary ops
      [
        Arel::Nodes::Not,
        Arel::Nodes::Group,
        Arel::Nodes::On,
        Arel::Nodes::Grouping,
        Arel::Nodes::Offset,
        Arel::Nodes::Ordering,
        Arel::Nodes::Having,
        Arel::Nodes::UnqualifiedColumn,
        Arel::Nodes::Top,
        Arel::Nodes::Limit,
      ].each do |klass|
        define_method("test_#{klass.name.gsub('::', '_')}") do
          op = klass.new(:a)
          @visitor.accept op
        end
      end

      # binary ops
      [
        Arel::Nodes::Assignment,
        Arel::Nodes::Between,
        Arel::Nodes::DoesNotMatch,
        Arel::Nodes::Equality,
        Arel::Nodes::GreaterThan,
        Arel::Nodes::GreaterThanOrEqual,
        Arel::Nodes::In,
        Arel::Nodes::LessThan,
        Arel::Nodes::LessThanOrEqual,
        Arel::Nodes::Matches,
        Arel::Nodes::NotEqual,
        Arel::Nodes::NotIn,
        Arel::Nodes::Or,
        Arel::Nodes::TableAlias,
        Arel::Nodes::Values,
        Arel::Nodes::As,
        Arel::Nodes::DeleteStatement,
        Arel::Nodes::JoinSource,
      ].each do |klass|
        define_method("test_#{klass.name.gsub('::', '_')}") do
          binary = klass.new(:a, :b)
          @visitor.accept binary
        end
      end
    end
  end
end

Version data entries

123 entries across 105 versions & 14 rubygems

Version Path
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/arel-3.0.3/test/visitors/test_dot.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_dot.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/arel-3.0.2/test/visitors/test_dot.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/visitors/test_dot.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/visitors/test_dot.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/arel-3.0.3/test/visitors/test_dot.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/arel-3.0.3/test/visitors/test_dot.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/visitors/test_dot.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/arel-3.0.3/test/visitors/test_dot.rb
arel-4.0.2 test/visitors/test_dot.rb
arel-5.0.0 test/visitors/test_dot.rb
arel-3.0.3 test/visitors/test_dot.rb
arel-4.0.1 test/visitors/test_dot.rb
challah-1.0.0 vendor/bundle/gems/arel-4.0.0/test/visitors/test_dot.rb
swipe-rails-0.0.5 vendor/bundle/gems/arel-3.0.2/test/visitors/test_dot.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_dot.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_dot.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_dot.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_dot.rb
challah-1.0.0.beta3 vendor/bundle/gems/arel-3.0.2/test/visitors/test_dot.rb