Skip to content

Commit

Permalink
Fix AR::TestFixtures.fixture_paths= docs
Browse files Browse the repository at this point in the history
This removes the deprecated .fixture_path and .fixture_path= methods
from public documentation, and creates a class method for the getter and
setters.

Interestingly because these methods were always `class_attribute` based,
which RDoc doesn't parse, they weren't technically "public"
documentation.
  • Loading branch information
zzak committed Jun 20, 2023
1 parent 2cdb05f commit 4a63d94
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions activerecord/lib/active_record/test_fixtures.rb
Expand Up @@ -17,6 +17,16 @@ def after_teardown # :nodoc:
end

included do
##
# :singleton-method: fixture_paths
#
# Returns the ActiveRecord::FixtureSet collection

##
# :singleton-method: fixture_paths=
#
# :call-seq:
# fixture_paths=(fixture_paths)
class_attribute :fixture_paths, instance_writer: false, default: []
class_attribute :fixture_table_names, default: []
class_attribute :fixture_class_names, default: {}
Expand All @@ -42,7 +52,7 @@ def set_fixture_class(class_names = {})
self.fixture_class_names = fixture_class_names.merge(class_names.stringify_keys)
end

def fixture_path
def fixture_path # :nodoc:
ActiveRecord.deprecator.warn(<<~WARNING)
TestFixtures.fixture_path is deprecated and will be removed in Rails 7.2. Use .fixture_paths instead.
If multiple fixture paths have been configured with .fixture_paths, then .fixture_path will just return
Expand All @@ -51,7 +61,7 @@ def fixture_path
fixture_paths.first
end

def fixture_path=(path)
def fixture_path=(path) # :nodoc:
ActiveRecord.deprecator.warn("TestFixtures.fixture_path= is deprecated and will be removed in Rails 7.2. Use .fixture_paths= instead.")
self.fixture_paths = Array(path)
end
Expand Down Expand Up @@ -99,7 +109,7 @@ def uses_transaction?(method)
end
end

def fixture_path
def fixture_path # :nodoc:
ActiveRecord.deprecator.warn(<<~WARNING)
TestFixtures#fixture_path is deprecated and will be removed in Rails 7.2. Use #fixture_paths instead.
If multiple fixture paths have been configured with #fixture_paths, then #fixture_path will just return
Expand Down

0 comments on commit 4a63d94

Please sign in to comment.