Sha256: 8f2976ab7b7f2b239d08f7424354d60e356df860d50a5b27ba3a3637c0699eeb

Contents?: true

Size: 956 Bytes

Versions: 19

Compression:

Stored size: 956 Bytes

Contents

# encoding: utf-8

require File.dirname(__FILE__) + '/test_helper'

class SluggedModelTest < Test::Unit::TestCase

  context "A slugged model using single table inheritance" do

    setup do
      Novel.friendly_id_options = FriendlyId::DEFAULT_FRIENDLY_ID_OPTIONS.merge(:column => :title, :use_slug => true)
      Novel.delete_all
      Slug.delete_all
      @novel = Novel.new :title => "Test novel"
      @novel.save!
    end

    should "have a slug" do
      assert_not_nil @novel.slug
    end

    context "found by its friendly id" do

      setup do
        @novel = Novel.find(@novel.friendly_id)
      end

      should "not indicate that it has a better id" do
        assert !@novel.has_better_id?
      end

    end


    context "found by its numeric id" do

      setup do
        @novel = Novel.find(@novel.id)
      end

      should "indicate that it has a better id" do
        assert @novel.has_better_id?
      end

    end

  end

end

Version data entries

19 entries across 19 versions & 6 rubygems

Version Path
nateabbott-friendly_id-2.1.4 test/sti_test.rb
nateabbott-friendly_id-2.1.7 test/sti_test.rb
nateabbott-friendly_id-2.1.8 test/sti_test.rb
nateabbott-nateabbott-friendly_id-2.1.5 test/sti_test.rb
nateabbott-nateabbott-friendly_id-2.1.6 test/sti_test.rb
norman-friendly_id-2.1.0 test/sti_test.rb
norman-friendly_id-2.1.1 test/sti_test.rb
norman-friendly_id-2.1.2 test/sti_test.rb
norman-friendly_id-2.1.3 test/sti_test.rb
norman-friendly_id-2.1.4 test/sti_test.rb
nwp-friendly_id-2.1.3 test/sti_test.rb
rakutenusa-friendly_id-2.0.8 test/sti_test.rb
rakutenusa-friendly_id-2.0.9 test/sti_test.rb
friendly_id-2.1.5 test/sti_test.rb
friendly_id-2.1.4 test/sti_test.rb
friendly_id-2.1.0 test/sti_test.rb
friendly_id-2.1.3 test/sti_test.rb
friendly_id-2.1.2 test/sti_test.rb
friendly_id-2.1.1 test/sti_test.rb