Sha256: d66c235681d63ff8a64afc522c53f54aa830f50acf06e6a4d5c636227dc399e9

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

require "helper"


class ObjectUtilsTest < TestCaseClass

  include FriendlyId::Test

  test "strings with letters are friendly_ids" do
    assert "a".friendly_id?
  end

  test "integers should be unfriendly ids" do
    assert 1.unfriendly_id?
  end

  test "numeric strings are neither friendly nor unfriendly" do
    assert_nil "1".friendly_id?
    assert_nil "1".unfriendly_id?
  end

  test "ActiveRecord::Base instances should be unfriendly_ids" do
    model_class = Class.new(ActiveRecord::Base) do
      self.table_name = "authors"
    end
    assert model_class.new.unfriendly_id?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
friendly_id-5.2.3 test/object_utils_test.rb