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

Don't call outer run_test! API requests inside nested context #652

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AlexMooney
Copy link

@AlexMooney AlexMooney commented Jun 27, 2023

Problem

When using a nested RSpec context, the outer run_test! cause unexpected API calls.

Solution

Avoid touching the before during run_test! because that causes the API calls to be inherited.

Related Issues

I searched for issues in GitHub but was not able to find any mention of this problem.

Checklist

  • Added tests
  • Changelog updated
  • Added documentation to README.md
    • Not sure if I should do this as the current readme makes no mention of context
  • Added example of using the enhancement into test-app
    • It's a fix for testing, so the test is itself an example of using it.

Steps to Test or Reproduce

Run the changed specs without the change to example_group_helpers.rb and you'll have a .count of 2: one for line 23 and a second for line 28.

@AlexMooney AlexMooney marked this pull request as ready for review June 27, 2023 22:14
before do |example|
submit_request(example.metadata)
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to make the same change to the if RSPEC_VERSION < 3 code above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants