Sha256: 3dad0cb6eeb978feb5d00484577de1fcbfef4a3112d07a5b559ab1dfee86cd81

Contents?: true

Size: 676 Bytes

Versions: 3

Compression:

Stored size: 676 Bytes

Contents

require "helper"

class NumericSlugTest < TestCaseClass
  include FriendlyId::Test
  include FriendlyId::Test::Shared::Core

  def model_class
    Article
  end

  test "should generate numeric slugs" do
    transaction do
      record = model_class.create! name: "123"
      assert_equal "123", record.slug
    end
  end

  test "should find by numeric slug" do
    transaction do
      record = model_class.create! name: "123"
      assert_equal model_class.friendly.find("123").id, record.id
    end
  end

  test "should exist? by numeric slug" do
    transaction do
      model_class.create! name: "123"
      assert model_class.friendly.exists?("123")
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/friendly_id-5.5.1/test/numeric_slug_test.rb
friendly_id-5.5.1 test/numeric_slug_test.rb
friendly_id-5.5.0 test/numeric_slug_test.rb