Last active
August 11, 2019 07:52
-
-
Save thegeorgeous/8ae7479ae13fc44d085e530c800da1a8 to your computer and use it in GitHub Desktop.
Find and Replace describe instances with RSpec.describe so that config.expose_dsl_globally can be set to false
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
file_names = Dir['./spec/**/*.rb'] # Get all the ruby files in spec | |
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') | |
File.open(file_name, 'w') { |file| file.puts new_contents } | |
puts 'Fixed' + file_name | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment