Class: Rsg::Generators::Testing::RspecGenerator
- Inherits:
-
Base
- Object
- Base
- Rsg::Generators::Testing::RspecGenerator
- Defined in:
- lib/rsg/generators/testing/rspec_generator.rb
Instance Method Summary collapse
- #add_rspec ⇒ Object
- #banner ⇒ Object
- #enable_recommendations ⇒ Object
- #gitignore ⇒ Object
- #install ⇒ Object
- #no_ci_focus ⇒ Object
Instance Method Details
#add_rspec ⇒ Object
6 7 8 |
# File 'lib/rsg/generators/testing/rspec_generator.rb', line 6 def add_rspec append_gem "rspec-rails", within_group: [:development, :test] end |
#banner ⇒ Object
2 3 4 |
# File 'lib/rsg/generators/testing/rspec_generator.rb', line 2 def say "Configuring rspec" end |
#enable_recommendations ⇒ Object
18 19 20 |
# File 'lib/rsg/generators/testing/rspec_generator.rb', line 18 def enable_recommendations gsub_file "spec/spec_helper.rb", /^# The settings below[^=]+=begin\n(.+)\n=end/m, '\1' end |
#gitignore ⇒ Object
10 11 12 |
# File 'lib/rsg/generators/testing/rspec_generator.rb', line 10 def gitignore append_file ".gitignore", "\n# Ignore rspec state\n/spec/examples.txt\n" end |
#install ⇒ Object
14 15 16 |
# File 'lib/rsg/generators/testing/rspec_generator.rb', line 14 def install generate("rspec:install") end |
#no_ci_focus ⇒ Object
22 23 24 25 26 |
# File 'lib/rsg/generators/testing/rspec_generator.rb', line 22 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 |