Sha256: 1729f44e16c3062c7f8a4740b99ac76d676b2b6f1abe9ff1f1d9e5e2165167db

Contents?: true

Size: 624 Bytes

Versions: 13

Compression:

Stored size: 624 Bytes

Contents

require "helper"


class ObjectUtilsTest < MiniTest::Unit::TestCase

  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_equal nil, "1".friendly_id?
    assert_equal 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

13 entries across 13 versions & 1 rubygems

Version Path
friendly_id-5.0.4 test/object_utils_test.rb
friendly_id-5.0.3 test/object_utils_test.rb
friendly_id-5.0.2 test/object_utils_test.rb
friendly_id-5.0.1 test/object_utils_test.rb
friendly_id-5.0.0 test/object_utils_test.rb
friendly_id-5.0.0.rc3 test/object_utils_test.rb
friendly_id-5.0.0.rc2 test/object_utils_test.rb
friendly_id-5.0.0.rc1 test/object_utils_test.rb
friendly_id-5.0.0.beta4 test/object_utils_test.rb
friendly_id-5.0.0.beta3 test/object_utils_test.rb
friendly_id-5.0.0.beta2 test/object_utils_test.rb
friendly_id-5.0.0.beta1 test/object_utils_test.rb
friendly_id-5.0.0.alpha.1 test/object_utils_test.rb