Sha256: 6021cd3df8cf1b0e7f82da4646cf7d932cc4cb61f579db0cac13fdf8e502cfbc

Contents?: true

Size: 644 Bytes

Versions: 5

Compression:

Stored size: 644 Bytes

Contents

module Rspec
  class DecoratorGenerator < ::Rails::Generators::NamedBase
    source_root File.expand_path('../templates', __FILE__)

    SPEC_ROOT = 'spec/decorators/'
    APPLICATION_DECORATOR_SPEC = 'application_decorator_spec.rb'
    APPLICATION_DECORATOR_SPEC_PATH = SPEC_ROOT + APPLICATION_DECORATOR_SPEC

    def build_model_and_application_decorator_specs
      empty_directory SPEC_ROOT
      unless File.exists?(APPLICATION_DECORATOR_SPEC_PATH)
        template APPLICATION_DECORATOR_SPEC, APPLICATION_DECORATOR_SPEC_PATH
      end
      template 'decorator_spec.rb', "#{SPEC_ROOT}#{singular_name}_decorator_spec.rb"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
draper-0.9.5 lib/generators/rspec/decorator_generator.rb
draper-0.9.3 lib/generators/rspec/decorator_generator.rb
draper-0.9.2 lib/generators/rspec/decorator_generator.rb
draper-0.9.1 lib/generators/rspec/decorator_generator.rb
draper-0.9.0 lib/generators/rspec/decorator_generator.rb