Sha256: f1af8b85d529afc695fae5f9e32f23fc1ee38e364650f5ed6879ea70637ea149

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

module Playmo
  module Recipes
    class RspecRecipe < Playmo::Recipe
      source_root File.expand_path('../templates/rspec_recipe', __FILE__)

      def setup
        question "Would you like to use Rspec in this project?" => :install_rspec
      end

    protected

      def install_rspec
        gem 'rspec-rails'

        Event.events.listen(:after_install) do |event_data|
          generate "rspec:install"
          remove_dir "test"
          
          inject_into_file "config/application.rb", :after => "class Application < Rails::Application\n" do
            <<-CONTENT.gsub(/^ {10}/, '')
              config.generators do |g|
                g.test_framework :rspec
              end
            CONTENT
          end
        end
        
        # TODO: copy helpers etc
        # TODO: factory_girl etc
      end

    end
  end
end

# Write down this recipe to our Cookbook if it's available
require File.dirname(__FILE__) + '/thinking_sphinx_recipe'
Playmo::Cookbook.instance.insert_after(Playmo::Recipes::ThinkingSphinxRecipe, Playmo::Recipes::RspecRecipe) if defined?(Playmo::Cookbook)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
playmo-0.0.18 lib/playmo/recipes/rspec_recipe.rb