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.

fake_objects.rb 1.2 kB

2 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # frozen_string_literal: true
  2. require 'cucumber/core/filter'
  3. # The following fake objects was previously declared within `describe` scope.
  4. # Declaring into scope did not isolate them.
  5. #
  6. # Moving these into a dedicated support file explicitly states that these are available globally as soon as they are required once.
  7. module FakeObjects
  8. module ModuleOne
  9. def method_one
  10. 1
  11. end
  12. end
  13. module ModuleMinusOne
  14. def method_one
  15. -1
  16. end
  17. end
  18. module ModuleTwo
  19. def method_two
  20. 2
  21. end
  22. end
  23. module ModuleThree
  24. def method_three
  25. 3
  26. end
  27. end
  28. class ClassOne
  29. end
  30. class Actor
  31. attr_accessor :name
  32. def initialize(name)
  33. @name = name
  34. end
  35. end
  36. class FlakyStepActions < ::Cucumber::Core::Filter.new
  37. def test_case(test_case)
  38. failing_test_steps = test_case.test_steps.map do |step|
  39. step.with_action { raise Failure }
  40. end
  41. passing_test_steps = test_case.test_steps.map do |step|
  42. step.with_action {}
  43. end
  44. test_case.with_steps(failing_test_steps).describe_to(receiver)
  45. test_case.with_steps(passing_test_steps).describe_to(receiver)
  46. end
  47. end
  48. end

No Description

Contributors (1)