Sha256: 5303bc27089606173386ea5c75c79f87b9e088983407d79ebf3bcec439c6f467

Contents?: true

Size: 496 Bytes

Versions: 8

Compression:

Stored size: 496 Bytes

Contents

# frozen_string_literal: true

module TestUnit
  module Generators
    class ComponentGenerator < ::Rails::Generators::NamedBase
      source_root File.expand_path("templates", __dir__)
      check_class_collision suffix: "ComponentTest"

      def create_test_file
        template "component_test.rb", File.join("test/components", "#{file_name}_component_test.rb")
      end

      private

      def file_name
        @_file_name ||= super.sub(/_component\z/i, "")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
actionview-component-1.7.0 lib/rails/generators/test_unit/component_generator.rb
actionview-component-1.6.2 lib/rails/generators/test_unit/component_generator.rb
actionview-component-1.6.1 lib/rails/generators/test_unit/component_generator.rb
actionview-component-1.6.0 lib/rails/generators/test_unit/component_generator.rb
actionview-component-1.5.3 lib/rails/generators/test_unit/component_generator.rb
actionview-component-1.5.2 lib/rails/generators/test_unit/component_generator.rb
actionview-component-1.5.1 lib/rails/generators/test_unit/component_generator.rb
actionview-component-1.5.0 lib/rails/generators/test_unit/component_generator.rb