Sha256: 6b0eb6c467d2552dedf6417712fb4d6283827eeb2404201083d451f9ef5c2c94

Contents?: true

Size: 703 Bytes

Versions: 11

Compression:

Stored size: 703 Bytes

Contents

require "helper"

class JournalistWithFriendlyFinders < ActiveRecord::Base
  self.table_name = 'journalists'
  extend FriendlyId
  scope :existing, -> {where('1 = 1')}
  friendly_id :name, use: [:slugged, :finders]
end

class Finders < MiniTest::Unit::TestCase

  include FriendlyId::Test

  def model_class
    JournalistWithFriendlyFinders
  end

  test 'should find records with finders as class methods' do
    with_instance_of(model_class) do |record|
      assert model_class.find(record.friendly_id)
    end
  end

  test 'should find records with finders on relations' do
    with_instance_of(model_class) do |record|
      assert model_class.existing.find(record.friendly_id)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
friendly_id-5.0.4 test/finders_test.rb
friendly_id-5.0.3 test/finders_test.rb
friendly_id-5.0.2 test/finders_test.rb
friendly_id-5.0.1 test/finders_test.rb
friendly_id-5.0.0 test/finders_test.rb
friendly_id-5.0.0.rc3 test/finders_test.rb
friendly_id-5.0.0.rc2 test/finders_test.rb
friendly_id-5.0.0.rc1 test/finders_test.rb
friendly_id-5.0.0.beta4 test/finders_test.rb
friendly_id-5.0.0.beta3 test/finders_test.rb
friendly_id-5.0.0.beta2 test/finders_test.rb