Sha256: 614af9048a370edc814c55b0b46fe12c13432f242859b11963cb2a8805bd033d

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require_relative "../helper"

module Arel
  module Nodes
    class TestBin < Arel::Test
      def test_new
        assert Arel::Nodes::Bin.new("zomg")
      end

      def test_default_to_sql
        viz  = Arel::Visitors::ToSql.new Table.engine.connection_pool
        node = Arel::Nodes::Bin.new(Arel.sql("zomg"))
        assert_equal "zomg", viz.accept(node, Collectors::SQLString.new).value
      end

      def test_mysql_to_sql
        viz  = Arel::Visitors::MySQL.new Table.engine.connection_pool
        node = Arel::Nodes::Bin.new(Arel.sql("zomg"))
        assert_equal "BINARY zomg", viz.accept(node, Collectors::SQLString.new).value
      end

      def test_equality_with_same_ivars
        array = [Bin.new("zomg"), Bin.new("zomg")]
        assert_equal 1, array.uniq.size
      end

      def test_inequality_with_different_ivars
        array = [Bin.new("zomg"), Bin.new("zomg!")]
        assert_equal 2, array.uniq.size
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ibm_db-5.5.0-x86-mingw32 test/cases/arel/nodes/bin_test.rb
ibm_db-5.4.1-x86-mingw32 test/cases/arel/nodes/bin_test.rb
ibm_db-5.4.0-x86-mingw32 test/cases/arel/nodes/bin_test.rb
ibm_db-5.3.2-x86-mingw32 test/cases/arel/nodes/bin_test.rb