Optimized the way of opening `phone_verification_code_enabled` in test
Now we use this way to open ApplicationSetting phone_verification_code_enabled
before running tests.
# We use the tag `phone_verification_code_enabled` to enable phone verification code in tests.
# Add it to your test if you want to enable the phone verification code feature.
# For example:
# describe '...', :phone_verification_code_enabled do
# end
# But we do not mock application_settings on test that use tag `do_not_mock_admin_mode_setting`
unless example.metadata.fetch(:do_not_mock_admin_mode_setting, false)
phone_enabled = example.metadata[:phone_verification_code_enabled].present?
stub_application_setting(phone_verification_code_enabled: phone_enabled)
end
This will stub phone_verification_code_enabled
in every test which is unnecessary. We should optimize the code, only stub phone_verification_code_enabled
in test that with tag :phone_verification_code_enabled
.