-
Notifications
You must be signed in to change notification settings - Fork 9
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
Include additional spec coverages for options param override #42
base: main
Are you sure you want to change the base?
Include additional spec coverages for options param override #42
Conversation
73f9903
to
34cbac7
Compare
sign_in_as do |**options| | ||
DummyUser.create!(name: options.dig(:example_custom_option, :name) || 'Example Tester') | ||
sign_in_as do |params| | ||
DummyUser.create!(name: params[:options][:example_custom_option][:name]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smudge This way works for passing the options through the callable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a spec-only change, though -- I think we'd want the library to provide a default generator here that expects the options, so that an end developer doesn't need to specify an around_persona_generation
in their config:
demo_mode/lib/demo_mode/config.rb
Line 76 in ccbccea
@around_persona_generation ||= :call.to_proc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'd expect this PR to make some change to the lib/
folder in order to get the test passing.
65d63cc
to
27e24f5
Compare
0e166b7
to
7886fac
Compare
lib/demo_mode/config.rb
Outdated
@@ -73,7 +73,7 @@ def around_persona_generation(&block) | |||
if block | |||
@around_persona_generation = block | |||
else | |||
@around_persona_generation ||= :call.to_proc | |||
@around_persona_generation ||= ->(generator, options) { generator.call(options: options) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smudge Is this what you are referencing to? I can remove the around block with this.
a57d116
to
ca208b5
Compare
@smudge any idea why the specs are failing? I am able to get these pass locally but getting these timeouts here. |
hmm, @smudge @pat-whitrock I am getting these GitHub action failures even after I reverted my changes as well. Any ideas? |
a675974
to
ca208b5
Compare
5b83232
to
802d411
Compare
This pull request includes several changes to the
demo_mode
feature, focusing on refining the persona generation process and enhancing test coverage. The main updates involve modifying how options are passed to generators and adding new test cases for better validation.Improvements to persona generation:
lib/demo_mode/config.rb
: Updated thearound_persona_generation
method to use a lambda that accepts a generator and options, ensuring options are passed correctly to the generator.Enhancements to test coverage:
spec/demo_mode_spec.rb
: Adjusted thearound_persona_generation
block to accept and pass options, improving test accuracy for theenabled?
method.spec/requests/demo_mode/sessions_spec.rb
: Added a nested context to test overriding persona generation witharound_persona_generation
, ensuring the correct handling of options.spec/requests/demo_mode/sessions_spec.rb
: Introduced a new test context for overriding persona generation withsign_in_as
, validating the creation of sessions and the correct saving of options.