Skip to content

Instantly share code, notes, and snippets.

@eval
Created November 25, 2024 17:11
Show Gist options
  • Save eval/fdbb24af5eb953aa7fd2d12db0e2b27e to your computer and use it in GitHub Desktop.
Save eval/fdbb24af5eb953aa7fd2d12db0e2b27e to your computer and use it in GitHub Desktop.
# Skip generating default test framework
say "Creating a Rails application with rspec-rails"
inside 'config' do
inject_into_file 'application.rb', after: "class Application < Rails::Application\n" do
<<-RUBY
config.generators do |g|
#g.hide_namespace "test_unit" # uncomment to apply the workaround, ie see no test_unit generators
end
RUBY
end
end
# Add rspec-rails gem to the Gemfile
say "Adding rspec-rails gem..."
gem_group :development, :test do
gem 'rspec-rails', '~> 6.0'
end
# Run bundle install
say "Installing gems..."
run 'bundle install'
# Run rspec:install to set up RSpec
say "Setting up RSpec..."
generate 'rspec:install'
say "Rails application is ready with RSpec configured!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment