Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

baffers
Copy link

@baffers baffers commented Oct 26, 2021

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)

Copy link
Contributor

@stitchfixsam stitchfixsam left a 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"
Copy link
Contributor

@brettfishman brettfishman Oct 26, 2021

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 :)

Copy link
Contributor

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.

@brettfishman brettfishman self-requested a review October 26, 2021 19:38
Copy link
Contributor

@brettfishman brettfishman left a 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 👍

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.

3 participants