-
-
Notifications
You must be signed in to change notification settings - Fork 115
Refactorized action rack implementation #78
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
Conversation
Looks good 👍 |
I need to create want test for rack builder in a couple of hours. Yesterday I forgot it |
test/integration/use_test.rb
Outdated
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.
is this correct?
UseAction::Index.rack_builder == UseAction::Show.rack_builder # => true
UseAction::Index.rack_builder.must_equal UseAction::Show.rack_builder
# => Fail
# No visible difference in the Rack::Builder#inspect output.
# You should look at the implementation of #== on Rack::Builder or its members.
UseAction::Index.rack_builder.object_id.must_equal UseAction::Show.rack_builder.object_id # => false
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.
I don't think this would add a value. We're testing a detail, instead of a behavior. Also, if Rack Team customizes Rack::Builder#==
this test will fail in the future.
The behavior that we want to describe is: given two actions with separated middleware stacks, those shall not to interfers each other.
What if we introduce YMiddleware
and let UseAction::Show
to use it? Then we could introspect the response and headers returned from /show
.
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.
ok, then I'll rewrite the test ;)
test/integration/use_test.rb
Outdated
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 low level detail that we can safely remove from here. The test already covers it. 🐱
@AlfonsoUceda This looks good! ✨ 👍 for me. |
@jodosha thanks for your help ;) |
@AlfonsoUceda ❇️ 👍 great work |
Refactorized action rack implementation
reference #72
Be careful before merging because the lotus-router is pointing to my fork and an especific branch related with this hanami/hanami-router#36 (later this will be restored to lotus/router github)
Thanks you @jodosha for the work