Sha256: 0592dc2dc900a3ab05806d73db86dfe1f6fbc2d57e0fd5d625457896d8870d56

Contents?: true

Size: 806 Bytes

Versions: 16

Compression:

Stored size: 806 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]
          "#{table_name.singularize}_spec.rb"
        else
          "#{table_name}_spec.rb"
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
rspec-rails-3.8.0 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.7.2 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.7.1 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.7.0 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.6.1 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.6.0 lib/generators/rspec/feature/feature_generator.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/rspec-rails-3.5.2/lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.6.0.beta2 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.6.0.beta1 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.5.2 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.5.1 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.5.0 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.5.0.beta4 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.5.0.beta3 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.5.0.beta2 lib/generators/rspec/feature/feature_generator.rb
rspec-rails-3.5.0.beta1 lib/generators/rspec/feature/feature_generator.rb