Sha256: 6ec96926aea700ee1f43eb91d8a071ac71e90828d919fe4ac3f9344001b86d59

Contents?: true

Size: 917 Bytes

Versions: 8

Compression:

Stored size: 917 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", "", "string(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", "", "string(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", "", "string")
    column = Valle::AbstractAdapter::CharacterLimitedColumn.new(original_column)

    assert_nil column.minimum
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
valle-1.0.0 test/lib/abstract_adapter/character_limited_column_test.rb
valle-0.2.3 test/lib/abstract_adapter/character_limited_column_test.rb
valle-0.2.2 test/lib/abstract_adapter/character_limited_column_test.rb
valle-0.2.1 test/lib/abstract_adapter/character_limited_column_test.rb
valle-0.2.0 test/lib/abstract_adapter/character_limited_column_test.rb
valle-0.1.0 test/lib/abstract_adapter/character_limited_column_test.rb
valle-0.0.3 test/lib/abstract_adapter/character_limited_column_test.rb
valle-0.0.2 test/lib/abstract_adapter/character_limited_column_test.rb