Uncomment default RSpec Rails config
Used 58 times
F
Fajarullah
Usage
Run this command in your Rails app directory in the terminal:
rails app:template LOCATION="https://railsbytes.com/script/XnJspa"
Template Source
Review the code before running this template on your machine.
def edit_file(path)
File.write(path, yield(File.read(path)))
end
edit_file("./spec/spec_helper.rb") do |content|
# delete block comment wrapper
content["=begin"] = ""
content["=end"] = ""
# commenting the unnecessary config
content.sub!(/(?=config.profile_examples = 10)/, "# ")
content.sub!(/(?=config.order = :random)/, "# ")
content.sub!(/(?=Kernel.srand config.seed)/, "# ")
content
end