Skip to content

Extract Grape::Endpoint.before_each into Grape::Testing#2681

Open
ericproulx wants to merge 1 commit intomasterfrom
extract_testing_module
Open

Extract Grape::Endpoint.before_each into Grape::Testing#2681
ericproulx wants to merge 1 commit intomasterfrom
extract_testing_module

Conversation

@ericproulx
Copy link
Copy Markdown
Contributor

Summary

  • Moves before_each, reset_before_each, and run_before_each out of Grape::Endpoint into a new opt-in Grape::Testing module
  • Production requests no longer pay any cost from this testing-only feature — run_before_each is only injected into Endpoint#run via prepend when require 'grape/testing' is called
  • before_each now always requires a block (raises ArgumentError otherwise); reset_before_each replaces the old before_each(nil) pattern
  • Removes lib/grape/endpoint.rb from Style/OptionalBooleanParameter rubocop todo

Test plan

  • bundle exec rspec spec/grape/testing_spec.rb — new dedicated spec for Grape::Testing
  • bundle exec rspec spec/grape/endpoint_spec.rb — verify no regression on endpoint behaviour

🤖 Generated with Claude Code

@ericproulx ericproulx requested a review from dblock April 17, 2026 13:24
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 17, 2026

Danger Report

No issues found.

View run

Move before_each, reset_before_each, and run_before_each out of
Grape::Endpoint and into an opt-in Grape::Testing module loaded via
`require 'grape/testing'`. Production requests no longer pay any cost
from this testing-only feature. RunBeforeEach is prepended into
Endpoint#run and ClassMethods is extended onto Grape::Endpoint only
when the testing module is required.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ericproulx ericproulx force-pushed the extract_testing_module branch from 932b2b8 to ba7386a Compare April 17, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant