Skip to content

Instantly share code, notes, and snippets.

@jwaldrip
Forked from barinek/app_builder.rb
Last active December 12, 2015 02:59
Show Gist options
  • Save jwaldrip/4703574 to your computer and use it in GitHub Desktop.
Save jwaldrip/4703574 to your computer and use it in GitHub Desktop.
class AppBuilder < Rails::AppBuilder
include Thor::Actions
include Thor::Shell
def test
append_test_gems
rspec_install
spork_init
guard_init
end
def rspec_install
say("Installing rspec from generator", :yellow)
`rails generate rspec:install`
create_file 'spec/lib/example_spec.rb', <<-RUBY, __FILE__, __LINE__ + 1
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
describe "example_spec" do
pending
end
RUBY
end
def spork_init
`spork rspec --bootstrap`
end
def guard_init
`guard init`
end
def append_test_gems
@generator.append_file 'Gemfile', <<-RUBY, __FILE__, __LINE__ + 1
group :test do
gem 'rspec-rails', '~> 2.12.2'
gem 'guard-rspec', '~> 2.4.0'
gem 'guard-spork', '~> 1.4.2'
gem 'database_cleaner', '0.5.2'
gem 'spork', '0.8.4'
end
RUBY
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment