Sha256: d1bcd27fb0068691e25c41255e2e7d4cf0e2715ff6ae7967bad280073198dfa7

Contents?: true

Size: 1003 Bytes

Versions: 3

Compression:

Stored size: 1003 Bytes

Contents

require "test_helper"

class CharacterLimitedColumnTest < TestCase

  def test_maximum_should_return_value_for_string_column
    original_column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", ::ActiveRecord::Type::String.new(limit: 255))
    column = Valle::AbstractAdapter::CharacterLimitedColumn.new(original_column)

    assert column.maximum
  end

  def test_maximum_should_return_correct_value_for_string_column_if_user_redefine_limit
    original_column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", ::ActiveRecord::Type::String.new(limit: 200))
    column = Valle::AbstractAdapter::CharacterLimitedColumn.new(original_column)

    assert_equal 200, column.maximum
  end

  def test_minimum_should_return_nil
    original_column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", ::ActiveRecord::Type::String.new)
    column = Valle::AbstractAdapter::CharacterLimitedColumn.new(original_column)

    assert_nil column.minimum
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
valle-1.1.2 test/lib/abstract_adapter/character_limited_column_test.rb
valle-1.1.1 test/lib/abstract_adapter/character_limited_column_test.rb
valle-1.1.0 test/lib/abstract_adapter/character_limited_column_test.rb