You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

state.feature 808 B

2 years ago
1234567891011121314151617181920212223242526272829303132
  1. Feature: State
  2. You can pass state between step by setting instance variables,
  3. but those instance variables will be gone when the next scenario runs.
  4. Scenario: Set an ivar in one scenario, use it in the next step
  5. Given a file named "features/test.feature" with:
  6. """
  7. Feature:
  8. Scenario:
  9. Given I have set @flag = true
  10. Then @flag should be true
  11. Scenario:
  12. Then @flag should be nil
  13. """
  14. And a file named "features/step_definitions/steps.rb" with:
  15. """
  16. Given /set @flag/ do
  17. @flag = true
  18. end
  19. Then /flag should be true/ do
  20. expect(@flag).to be_truthy
  21. end
  22. Then /flag should be nil/ do
  23. expect(@flag).to be_nil
  24. end
  25. """
  26. When I run `cucumber`
  27. Then it should pass

No Description

Contributors (1)