Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Add dry-run option #129

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/crystalball/rspec/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,23 @@ def run(args, err = $stderr, out = $stdout)

Crystalball.log :info, "Crystalball starts to glow..."
prediction = build_prediction

dry_prediction(prediction)

Crystalball.log :debug, "Prediction: #{prediction.first(5).join(' ')}#{'...' if prediction.size > 5}"
Crystalball.log :info, "Starting RSpec."

super(args + prediction, err, out)
end

def dry_prediction (prediction)
args = Hash[ ARGV.flat_map{|s| s.scan(/--?([^=\s]+)(?:=(\S+))?/) } ]
if args.key?('dry-prediction')
array = prediction.to_a
File.write('./crystalball_spec_list.txt', array.join(","))
exit
end
end

def reset!
self.prediction_builder = nil
self.config = nil
Expand Down