Sha256: decd72c6c4233aeb351c598262bd198e9e54baeda8518b3c955cf4e096a7c20f

Contents?: true

Size: 482 Bytes

Versions: 13

Compression:

Stored size: 482 Bytes

Contents

# encoding: UTF-8

require File.expand_path("./helper", File.dirname(__FILE__))

module Finder
  def [](id)
    new(id)
  end
end

class BaseWithoutToParam < Struct.new(:id)
  extend Finder

  include Ohm::Slug

  def to_s
    "A very Unique and Interesting String?'"
  end
end

test "to_param" do
  obj = BaseWithoutToParam.new(1)

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

test "finding" do
  assert 1 == BaseWithoutToParam['1-a-very-unique'].id
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ohm-contrib-0.1.2 test/slug_test.rb
ohm-contrib-0.1.1 test/slug_test.rb
ohm-contrib-0.1.0 test/slug_test.rb
ohm-contrib-0.0.42 test/slug_test.rb
ohm-contrib-0.0.41 test/slug_test.rb
ohm-contrib-0.0.40 test/slug_test.rb
ohm-contrib-0.0.39 test/slug_test.rb
ohm-contrib-0.0.38 test/slug_test.rb
ohm-contrib-0.0.37 test/slug_test.rb
ohm-contrib-0.0.36 test/slug_test.rb
ohm-contrib-0.0.35 test/slug_test.rb
ohm-contrib-0.0.34 test/slug_test.rb
ohm-contrib-0.0.33 test/slug_test.rb