diff --git a/spec/support/unit/configuration.rb b/spec/support/unit/configuration.rb new file mode 100644 index 000000000..469a34cfe --- /dev/null +++ b/spec/support/unit/configuration.rb @@ -0,0 +1,27 @@ +module UnitTests + class Configuration + CLASSES = %i[ + ActionPackVersions + ActiveModelHelpers + ActiveModelVersions + ActiveRecordVersions + ClassBuilder + ColumnTypeHelpers + ControllerBuilder + DatabaseHelpers + I18nFaker + MailerBuilder + MessageHelpers + ModelBuilder + RailsVersions + ValidationMatcherScenarioHelpers + ].freeze + + def self.configure_example_groups(config) + CLASSES.each do |class_name| + constantized_class = "UnitTests::#{class_name}" + Object.const_get(constantized_class).configure_example_group(config) + end + end + end +end diff --git a/spec/unit_spec_helper.rb b/spec/unit_spec_helper.rb index 18a01c23f..ac7cb0e2f 100644 --- a/spec/unit_spec_helper.rb +++ b/spec/unit_spec_helper.rb @@ -15,21 +15,7 @@ RSpec.configure do |config| config.include RSpec::Matchers::FailMatchers - UnitTests::ActionPackVersions.configure_example_group(config) - UnitTests::ActiveModelHelpers.configure_example_group(config) - UnitTests::ActiveModelVersions.configure_example_group(config) - UnitTests::ClassBuilder.configure_example_group(config) - UnitTests::ControllerBuilder.configure_example_group(config) - UnitTests::I18nFaker.configure_example_group(config) - UnitTests::MailerBuilder.configure_example_group(config) - UnitTests::ModelBuilder.configure_example_group(config) - UnitTests::RailsVersions.configure_example_group(config) - UnitTests::ActiveRecordVersions.configure_example_group(config) - UnitTests::ActiveModelVersions.configure_example_group(config) - UnitTests::DatabaseHelpers.configure_example_group(config) - UnitTests::ColumnTypeHelpers.configure_example_group(config) - UnitTests::ValidationMatcherScenarioHelpers.configure_example_group(config) - UnitTests::MessageHelpers.configure_example_group(config) + UnitTests::Configuration.configure_example_group(config) config.include UnitTests::Matchers