Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 474e3b0

Browse files
committed
Privatize config functions that should not be public.
1 parent 6b8257d commit 474e3b0

File tree

1 file changed

+39
-47
lines changed

1 file changed

+39
-47
lines changed

lib/rspec/core/configuration.rb

Lines changed: 39 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,21 +1250,6 @@ def configure_group(group)
12501250
configure_group_with group, @prepend_modules, :safe_prepend
12511251
end
12521252

1253-
# @private
1254-
def configure_group_with(group, module_list, application_method)
1255-
module_list.items_for(group.metadata).each do |mod|
1256-
__send__(application_method, mod, group)
1257-
end
1258-
end
1259-
1260-
# @private
1261-
def configure_existing_groups(mod, meta, application_method)
1262-
world.all_example_groups.each do |group|
1263-
next unless meta.empty? || MetadataFilter.apply?(:any?, meta, group.metadata)
1264-
__send__(application_method, mod, group)
1265-
end
1266-
end
1267-
12681253
# @private
12691254
#
12701255
# Used internally to extend the singleton class of a single example's
@@ -1284,13 +1269,6 @@ def configure_example(example)
12841269
end
12851270
end
12861271

1287-
if RSpec::Support::RubyFeatures.module_prepends_supported?
1288-
# @private
1289-
def safe_prepend(mod, host)
1290-
host.__send__(:prepend, mod) unless host < mod
1291-
end
1292-
end
1293-
12941272
# @private
12951273
def requires=(paths)
12961274
directories = ['lib', default_path].select { |p| File.directory? p }
@@ -1308,31 +1286,6 @@ def in_project_source_dir_regex
13081286
Regexp.union(regexes)
13091287
end
13101288

1311-
# @private
1312-
if RUBY_VERSION.to_f >= 1.9
1313-
# @private
1314-
def safe_include(mod, host)
1315-
host.__send__(:include, mod) unless host < mod
1316-
end
1317-
1318-
# @private
1319-
def safe_extend(mod, host)
1320-
host.extend(mod) unless host.singleton_class < mod
1321-
end
1322-
else # for 1.8.7
1323-
# :nocov:
1324-
# @private
1325-
def safe_include(mod, host)
1326-
host.__send__(:include, mod) unless host.included_modules.include?(mod)
1327-
end
1328-
1329-
# @private
1330-
def safe_extend(mod, host)
1331-
host.extend(mod) unless (class << host; self; end).included_modules.include?(mod)
1332-
end
1333-
# :nocov:
1334-
end
1335-
13361289
# @private
13371290
def configure_mock_framework
13381291
RSpec::Core::ExampleGroup.__send__(:include, mock_framework)
@@ -1866,6 +1819,45 @@ def clear_values_derived_from_example_status_persistence_file_path
18661819
@last_run_statuses = nil
18671820
@spec_files_with_failures = nil
18681821
end
1822+
1823+
def configure_group_with(group, module_list, application_method)
1824+
module_list.items_for(group.metadata).each do |mod|
1825+
__send__(application_method, mod, group)
1826+
end
1827+
end
1828+
1829+
def configure_existing_groups(mod, meta, application_method)
1830+
world.all_example_groups.each do |group|
1831+
next unless meta.empty? || MetadataFilter.apply?(:any?, meta, group.metadata)
1832+
__send__(application_method, mod, group)
1833+
end
1834+
end
1835+
1836+
if RSpec::Support::RubyFeatures.module_prepends_supported?
1837+
def safe_prepend(mod, host)
1838+
host.__send__(:prepend, mod) unless host < mod
1839+
end
1840+
end
1841+
1842+
if RUBY_VERSION.to_f >= 1.9
1843+
def safe_include(mod, host)
1844+
host.__send__(:include, mod) unless host < mod
1845+
end
1846+
1847+
def safe_extend(mod, host)
1848+
host.extend(mod) unless host.singleton_class < mod
1849+
end
1850+
else # for 1.8.7
1851+
# :nocov:
1852+
def safe_include(mod, host)
1853+
host.__send__(:include, mod) unless host.included_modules.include?(mod)
1854+
end
1855+
1856+
def safe_extend(mod, host)
1857+
host.extend(mod) unless (class << host; self; end).included_modules.include?(mod)
1858+
end
1859+
# :nocov:
1860+
end
18691861
end
18701862
# rubocop:enable Metrics/ClassLength
18711863
end

0 commit comments

Comments
 (0)