Skip to content

Instantly share code, notes, and snippets.

@keithrbennett
Created October 19, 2012 01:19
Show Gist options
  • Select an option

  • Save keithrbennett/3915729 to your computer and use it in GitHub Desktop.

Select an option

Save keithrbennett/3915729 to your computer and use it in GitHub Desktop.
A Rails builder that will create projects using RSpec instead of TestUnit.
# A Rails builder that will create projects using RSpec instead of TestUnit.
# Invoke as: rails new my_project builder=rspec-rails-builder.rb
class AppBuilder < Rails::AppBuilder
# Override superclass test method to do rspec stuff.
def test
puts('Adding rspec to Gemfile.')
append_rspec_to_gemfile
puts('Calling rails generate rspec:install')
system('rails generate rspec:install')
end
private
def append_rspec_to_gemfile
@generator.append_file 'Gemfile', %{
group :test do
gem 'rspec-rails'
end
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment