Sha256: 18aeb5906e9b5adcbd60c10fe30aa9053a16537a14acfc02cd439efce65fc6c7

Contents?: true

Size: 783 Bytes

Versions: 19

Compression:

Stored size: 783 Bytes

Contents

require 'generators/rspec'

module Rspec
  module Generators
    # @private
    class FeatureGenerator < Base
      class_option :feature_specs, type: :boolean, default: true,  desc: "Generate feature specs"
      class_option :singularize,   type: :boolean, default: false, desc: "Singularize the generated feature"

      def generate_feature_spec
        return unless options[:feature_specs]

        template template_name, target_path('features', class_path, filename)
      end

      def template_name
        options[:singularize] ? 'feature_singular_spec.rb' : 'feature_spec.rb'
      end

      def filename
        if options[:singularize]
          "#{file_name.singularize}_spec.rb"
        else
          "#{file_name}_spec.rb"
        end
      end
    end
  end
end

Version data entries

19 entries across 18 versions & 4 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/rspec-rails-7.1.0/lib/generators/rspec/feature/feature_generator.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/rspec-rails-7.1.0/lib/generators/rspec/feature/feature_generator.rb
rspec-rails-7.1.0 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-7.0.2 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-7.0.1 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-7.0.0 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.1.5 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.1.4 lib/generators/rspec/feature/feature_generator.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rspec-rails-6.1.3/lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.1.3 lib/generators/rspec/feature/feature_generator.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/rspec-rails-6.0.4/lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.1.2 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.1.1 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.1.0 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.0.4 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.0.3 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.0.2 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.0.1 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-6.0.0 lib/generators/rspec/feature/feature_generator.rb