Sha256: f07751689882a91729b5010d5f318ef50617610f2053edae11ab2e032a8bed0e

Contents?: true

Size: 804 Bytes

Versions: 2

Compression:

Stored size: 804 Bytes

Contents

require 'rails_generator'

module PluginAWeek #:nodoc:
  module PluginTestHelper
    # The base generator for creating parts of the test application. The first
    # argument of the generator is always the name of the plugin.
    class Generator < Rails::Generator::NamedBase
      attr_accessor :plugin_name
      
      def initialize(*runtime_args) #:nodoc:
        @plugin_name = runtime_args.first.shift if runtime_args.first.is_a?(Array)
        super(*runtime_args)
      end
      
      private
        # The root path of the plugin's test directory
        def plugin_test_root
          "vendor/plugins/#{plugin_name}/test"
        end
        
        # The root path of the plugin's test app
        def plugin_app_root
          "#{plugin_test_root}/app_root"
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plugin_test_helper-0.1.5 lib/plugin_test_helper/generator.rb
plugin_test_helper-0.1.6 lib/plugin_test_helper/generator.rb