class Wooandoo::Generators::TestingGenerator
Public Instance Methods
configure_rails_application_for_testing()
click to toggle source
# File lib/generators/wooandoo/testing/testing_generator.rb, line 10 def configure_rails_application_for_testing add_gems init_pry init_rspec init_spork init_guard update_test_environment end
Protected Instance Methods
add_gems()
click to toggle source
# File lib/generators/wooandoo/testing/testing_generator.rb, line 24 def add_gems append_to_file "Gemfile", "\n\n# GEM FOR TESTING\n\n" gem 'spork', '~> 0.9.0.rc9', :group => :test gem 'rb-fsevent', :group => :test gem 'growl', :group => :test gem 'guard-spork', :group => :test gem 'guard-bundler', :group => :test gem 'guard-migrate', :group => :test gem "rspec-rails", :group => [:test, :development] gem "guard-rspec", :group => :test gem "capybara", :group => :test gem "capybara-webkit", :group => :test gem "launchy", :group => :test gem "factory_girl_rails", :group => :test gem 'database_cleaner', :group => :test gem 'timecop', :group => :test gem 'pry', :group => [:test, :development] end
init_guard()
click to toggle source
# File lib/generators/wooandoo/testing/testing_generator.rb, line 71 def init_guard run "guard init spork" run "guard init bundler" run "guard init migrate" run "guard init rspec" gsub_file "Guardfile", /guard 'spork'(.*?) do/, "guard 'spork'\1, :wait => 10 do" gsub_file "Guardfile", /guard 'rspec'(.*?) do/, "guard 'rspec'\1, :cli => \"--drb -f d\", :all_on_start => false, :all_after_pass => false do" end
init_pry()
click to toggle source
# File lib/generators/wooandoo/testing/testing_generator.rb, line 83 def init_pry # see https://gist.github.com/1190475 # add # silence_warnings do # begin # require 'pry' # IRB = Pry # rescue LoadError # end # end end
init_rspec()
click to toggle source
# File lib/generators/wooandoo/testing/testing_generator.rb, line 53 def init_rspec generate "rspec:install" %w{spec/support spec/models spec/routing spec/macro spec/factories spec/requests spec/mailers spec/controllers spec/helpers}.each do |path| empty_directory path end end
init_spork()
click to toggle source
# File lib/generators/wooandoo/testing/testing_generator.rb, line 64 def init_spork run "spork --bootstrap" template "spec_helper.rb", "spec/spec_helper.rb", :force => true end
update_test_environment()
click to toggle source
# File lib/generators/wooandoo/testing/testing_generator.rb, line 97 def update_test_environment gsub_file File.join("config", "environments", "test.rb"), /config.cache_classes = true/, "config.cache_classes = false" end