Skip to content

Commit

Permalink
add small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardrudko committed Apr 19, 2021
1 parent e96c502 commit 0849c80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
4 changes: 2 additions & 2 deletions features/docs/cli/retry_failing_tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ Feature: Retry failing tests
"""

Scenario: Flaky scenario gives zero exit code in no-strict-flaky mode if flaky step fails, passes and skips scenario
And a scenario "Flaky-skip" that fails three times, passes and then skips scenario
When I run `cucumber --retry 3 --no-strict-flaky --format summary`
And a scenario "Flaky-skip" that fails once, passes and then skips scenario
When I run `cucumber --retry 1 --no-strict-flaky --format summary`
Then it should pass with:
"""
Expand Down
19 changes: 2 additions & 17 deletions features/lib/step_definitions/scenarios_and_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ def snake_case(name)
write_file("features/step_definitions/steps#{SecureRandom.uuid}.rb", content)
end

Given('a scenario {string} that fails three times, passes and then skips scenario') do |full_name|
Given('a scenario {string} that fails once, passes and then skips scenario') do |full_name|
name = snake_case(full_name)

create_feature("#{full_name} feature") do
create_scenario(full_name) do
"""
Given it three times, then passes
Given it fails once, then passes
And it skips scenario
"""
end
Expand All @@ -127,21 +127,6 @@ def snake_case(name)
step_definition('/^it skips scenario/', 'skip_this_scenario')
)

write_file(
"features/step_definitions/#{name}_steps.rb",
[
step_definition('/^it skips scenario/', 'skip_this_scenario'),
step_definition(
'/^it three times, then passes/',
[
"$#{name} ||= 0",
"$#{name} += 1",
"expect($#{name}).to be > 3"
]
)
].join("\n")
)

write_file(
"features/support/#{name}_init.rb",
" $#{name} = 0"
Expand Down

0 comments on commit 0849c80

Please sign in to comment.