Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file_names = Dir['./spec/**/*.rb'] # Get all the ruby files
- file_names.each do |file_name|
- next if ['./spec/spec_helper.rb', './spec/rails_helper.rb'].include? file_name
- text = File.read(file_name)
- next if text.include?('RSpec.describe')
- new_contents = text.sub(/describe/, 'RSpec.describe')
- # To write changes to the file, use:
- File.open(file_name, 'w') { |file| file.puts new_contents }
- puts 'Fixed' + file_name
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement