Sha256: d383d2634ca00a338bf93b01c74b432477e87ed15965aacce1a663b92cb7f86f
Contents?: true
Size: 1.05 KB
Versions: 27
Compression:
Stored size: 1.05 KB
Contents
# encoding: utf-8 require File.dirname(__FILE__) + '/test_helper' class CustomSlugNormalizerTest < Test::Unit::TestCase context "A slugged model using a custom slug generator" do setup do Thing.friendly_id_options = FriendlyId::DEFAULT_FRIENDLY_ID_OPTIONS.merge(:column => :name, :use_slug => true) Thing.delete_all Slug.delete_all end should "invoke the block code" do @thing = Thing.create!(:name => "test") assert_equal "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", @thing.friendly_id end should "respect the max_length option" do Thing.friendly_id_options = Thing.friendly_id_options.merge(:max_length => 10) @thing = Thing.create!(:name => "test") assert_equal "a94a8fe5cc", @thing.friendly_id end should "respect the reserved option" do Thing.friendly_id_options = Thing.friendly_id_options.merge(:reserved => ["a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"]) assert_raises FriendlyId::SlugGenerationError do Thing.create!(:name => "test") end end end end
Version data entries
27 entries across 27 versions & 8 rubygems