Sha256: b6da6ca7d96d21d13544de173b1910f25973cfd74991a9835045c295328f60e7

Contents?: true

Size: 481 Bytes

Versions: 3

Compression:

Stored size: 481 Bytes

Contents

# encoding: UTF-8

require_relative "helper"

class Article < Ohm::Model
  include Ohm::Slug
  attribute :title

  def to_s
    title
  end
end

test "to_param" do
  article = Article.create(title: "A very Unique and Interesting String?'")

  assert '1-a-very-unique-and-interesting-string' == article.to_param
end

test "finding" do
  article = Article.create(title: "A very Unique and Interesting String?'")

  assert 1 == Article["1-a-very-unique-and-interesting-string"].id
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ohm-contrib-1.0.0.rc2 test/slug.rb
ohm-contrib-1.0.rc1 test/slug.rb
ohm-contrib-1.0.rc0 test/slug.rb