Sha256: 38ad84c2df8072f90b732dfb3dce57fe3df163e756bf6a7b624fd2e86c1ac97c

Contents?: true

Size: 804 Bytes

Versions: 7

Compression:

Stored size: 804 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, File.join('spec/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

7 entries across 7 versions & 1 rubygems

Version Path
rspec-rails-3.9.1 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-4.0.0.beta3 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.8.3 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.9.0 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-4.0.0.beta2 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.8.2 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.8.1 lib/generators/rspec/feature/feature_generator.rb