class Rsg::Generators::Testing::RspecGenerator < Rsg::Generators::Base def banner say "Configuring rspec" end def add_rspec append_gem "rspec-rails", within_group: [:development, :test] end def gitignore append_file ".gitignore", "\n# Ignore rspec state\n/spec/examples.txt\n" end def install generate("rspec:install") end def enable_recommendations gsub_file "spec/spec_helper.rb", /^# The settings below[^=]+=begin\n(.+)\n=end/m, '\1' end def no_ci_focus gsub_file "spec/spec_helper.rb", /^ config\.filter_run_when_matching :focus$/ do " if ENV.key?(\"CI\")\n config.filter_run_when_matching :focus\n end" end end end