Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Enhance unit test helpers loading #1585

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions spec/support/unit/configuration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module UnitTests
class Configuration
CLASSES = %i[
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
15 changes: 1 addition & 14 deletions spec/unit_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,7 @@
RSpec.configure do |config|
config.include RSpec::Matchers::FailMatchers

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_groups(config)

config.include UnitTests::Matchers

Expand Down
Loading