Closed janwerkhoven closed 5 years ago
@janwerkhoven Did you notice that authorize_api_requests.rb
is named using plural instead of singular? Try renaming to authorize_api_request.rb
Apologies, that's a typo. I've verified and the file name is app/commands/authorize_api_request.rb
as described in this tutorial: https://www.pluralsight.com/guides/ruby-ruby-on-rails/token-based-authentication-with-ruby-on-rails-5-api
It works beautifully when curling to localhost:3000, but breaks in tests... Any suggestions?
@janwerkhoven From what I can see in these two examples you showed, looks like you added an additional folder called admin/
and some controllers inside it. Keep in mind that this will could change the namespace behavior for these classes.
Double check if your failing test is on the same path. ex: test/controllers/admin/your_test_file
A full stacktrace or at least the code line its calling that command
reference would help to solve this issue.
cheers
Closing since too much time passed (sorry), feel free to reopen if this is still a thing.
I've followed this tutorial for JSON Web Tokens and things Simple Command work beautifully until I hit the tests. In the tests the commands each time
AuthorizeApiRequest
is called I get this error:LoadError: Unable to autoload constant AuthorizeApiRequest
.Am I missing something here? Does one need to do something extra to use Simple Commands in tests?