-
Notifications
You must be signed in to change notification settings - Fork 10
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
Mock SDK for testing purposes #65
Comments
Hey @sebak94 since nobody from Clerk has responded to this, I have set up a few little helpers for myself that I can share: 1. Mock the call to the jwks endpointAdd a copy of the JSON response body of an authorized request to Add a stub to Rspec for this endpoint - I never wanted this call to be made so I put it in my
2. Set up a shared context for authI add two files to my
Then my shared context can look like this:
In fact, the This snippet includes setting the time to the window when the bearer token is valid before/after the spec as well, using the When you put it all together, it means I can add
And you can also use the variables from the bearer token for your factories etc, for example:
Hope that helps, let me know if you have any questions! |
Hi there! I'm using the
include Clerk::Authenticatable
in my controllers and abefore_action
filter to require authentication. How can I mock the SDK or the Rack middleware to test my controllers with Rspec?The text was updated successfully, but these errors were encountered: