Skip to content

Conversation

@shashankmehra
Copy link
Collaborator

After a recent change instance variables were not properly accessible or shared between steps in RSpec steps. This caused issues when trying to:

  • Set instance variables in one step and access them in subsequent steps
  • Use before blocks that set instance variables
  • Share state between different steps in the same test suite

This PR implements several key changes to fix instance variable access:

  • Modified StepExampleRunner to copy all instance variables from the context example during initialization
    • This ensures that instance variables set in the context are available to all steps
  • Prefixed internal runner variables with underscore (@_context_example, @_running_example, etc.)
    • This prevents conflicts between internal step runner state and user-defined instance variables

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