-
Notifications
You must be signed in to change notification settings - Fork 21
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
Update api_spec to not use capyabara #106
base: main
Are you sure you want to change the base?
Conversation
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.
Brilliant!
@@ -47,7 +47,7 @@ def bootstrap_api | |||
copy_file "app/models/api_client.rb" | |||
copy_file "config/initializers/stitches.rb" | |||
copy_file "lib/tasks/generate_api_key.rake" | |||
template "spec/features/api_spec.rb.erb", "spec/features/api_spec.rb" | |||
template "spec/requests/api_spec.rb.erb", "spec/requests/api_spec.rb" |
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 wonder if rather than moving to request specs, we should be migrating to system specs which (IIRC) provide the benefits of feature tests (e.g. integration tests) without the need of the capybara gem? Whereas request specs are essentially testing from the controller perspective. Nix that whole comment :)
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.
Whoops, looks like I misremembered that! System tests also use Capybara under the hood.
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.
Yep, makes sense to me 👍
Problem
The
api_spec
is a feature test, which means it requires the capybara gem. Most services probably don't need capybara since it's usually for testing front end interactions. We can achieve the same result as the feature test by using a request spec, which means that services won't require capybara off the bat.Solution
Update
api_spec
to be a request spec instead of a feature test (also opening a PR in app-template)