class Gemsmith::Generators::Rspec
Generates RSpec support.
Public Instance Methods
run()
click to toggle source
# File lib/gemsmith/generators/rspec.rb, line 7 def run if configuration.dig :generate, :rspec install_templates else remove_rake_lines end end
Private Instance Methods
install_rails_helper()
click to toggle source
# File lib/gemsmith/generators/rspec.rb, line 32 def install_rails_helper return unless configuration.dig :generate, :engine template "#{rspec_root}/rails_helper.rb.tt" end
install_templates()
click to toggle source
# File lib/gemsmith/generators/rspec.rb, line 22 def install_templates template "#{rspec_root}/spec_helper.rb.tt" install_rails_helper template "#{rspec_root}/support/shared_contexts/temp_dir.rb.tt" end
remove_rake_lines()
click to toggle source
# File lib/gemsmith/generators/rspec.rb, line 17 def remove_rake_lines cli.gsub_file "#{gem_name}/Rakefile", /require.+rspec.+\n/, "" cli.gsub_file "#{gem_name}/Rakefile", /RSpec.+\n/, "" end
rspec_root()
click to toggle source
# File lib/gemsmith/generators/rspec.rb, line 28 def rspec_root "%gem_name%/spec" end