Created
October 19, 2012 01:19
-
-
Save keithrbennett/3915729 to your computer and use it in GitHub Desktop.
A Rails builder that will create projects using RSpec instead of TestUnit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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