Last active
August 29, 2015 14:20
-
-
Save ciembor/b386de62e29a99b4ed1e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :failing_cucumber_specs do | |
FAILING_SCENARIOS_FILENAME = 'failing_scenarios.txt' | |
task :record do | |
# run cucumber and record failing scenarios to the file | |
begin | |
Rake::Task['knapsack:cucumber'].invoke("-f rerun --out #{FAILING_SCENARIOS_FILENAME}") | |
rescue SystemExit => e | |
# exit 0, we don't want failed build because of this task | |
puts "#{e.class}: #{e.message}" | |
exit 0 | |
end | |
end | |
task :rerun do | |
# we don't need to run cucumber again if all scenarios passed | |
unless File.zero?("#{FAILING_SCENARIOS_FILENAME}") | |
# run cucumber with failing scenarios only | |
exec("bundle exec cucumber @#{FAILING_SCENARIOS_FILENAME}") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment