Optimize factory usage in subscription_entity_spec

What does this MR do and why?

This MR replaces create with build_stubbed in spec/serializers/jira_connect/subscription_entity_spec.rb to optimize factory usage as recommended in our handbook. This spec is part of the list .rubocop_todo/rspec/factory_bot/avoid_create.yml. It was verified that database persistence is not needed using the factory doctor command FDOC=1 bin/rspec spec/serializers/jira_connect/subscription_entity_spec.rb.

Factory Usage Optimization Results

Before optimization:

  • Factory time: 0.375s (2.75% of total time)

After optimization:

  • Factory time: 0.024s (0.19% of total time)

Improvement:

  • Factory time reduced by: 0.351s
  • Factory time percentage reduced by: 2.56%
  • Overall factory usage improvement: 93.6%

Factory Doctor Output

[TEST PROF INFO] FactoryDoctor report

Total (potentially) bad examples: 1
Total wasted time: 00:00.320

JiraConnect::SubscriptionEntity (./spec/serializers/jira_connect/subscription_entity_spec.rb:5) (7 records created, 00:00.320)
  contains all necessary elements of the subscription (./spec/serializers/jira_connect/subscription_entity_spec.rb:12)  7 records created, 00:00.320

This MR also adds the missing feature_category to this spec.

References

Relates to: #378910

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Marcos Rocha

Merge request reports

Loading