Sha256: a73a2838d5eb6a14ea488cf3883a961a132ec1a6bc38151325dab70ead774206

Contents?: true

Size: 441 Bytes

Versions: 5

Compression:

Stored size: 441 Bytes

Contents

# frozen_string_literal: true

module Rspec
  module Generators
    class ComponentGenerator < ::Rails::Generators::NamedBase
      source_root File.expand_path("templates", __dir__)

      def create_test_file
        template "component_spec.rb", File.join("spec/components", "#{file_name}_component_spec.rb")
      end

      private

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
actionview-component-1.7.0 lib/rails/generators/rspec/component_generator.rb
actionview-component-1.6.2 lib/rails/generators/rspec/component_generator.rb
actionview-component-1.6.1 lib/rails/generators/rspec/component_generator.rb
actionview-component-1.6.0 lib/rails/generators/rspec/component_generator.rb
actionview-component-1.5.3 lib/rails/generators/rspec/component_generator.rb