Sha256: 7209624925da65aae4b6ef07701b71ab289aecb472c68d9a474fe1435f41c9c9

Contents?: true

Size: 1.37 KB

Versions: 17

Compression:

Stored size: 1.37 KB

Contents

require 'rails/generators/named_base'
require 'rspec/core'
require 'rspec/rails/feature_check'

# @private
# Weirdly named generators namespace (should be `RSpec`) for compatibility with
# rails loading.
module Rspec
  # @private
  module Generators
    # @private
    class Base < ::Rails::Generators::NamedBase
      include RSpec::Rails::FeatureCheck

      def self.source_root(path = nil)
        if path
          @_rspec_source_root = path
        else
          @_rspec_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'rspec', generator_name, 'templates'))
        end
      end

      # @private
      # Load configuration from RSpec to ensure `--default-path` is set
      def self.configuration
        @configuration ||=
          begin
            configuration = RSpec.configuration
            options = RSpec::Core::ConfigurationOptions.new({})
            options.configure(configuration)
            configuration
          end
      end

      def target_path(*paths)
        File.join(self.class.configuration.default_path, *paths)
      end
    end
  end
end

# @private
module Rails
  module Generators
    # @private
    class GeneratedAttribute
      def input_type
        @input_type ||= if type == :text
                          "textarea"
                        else
                          "input"
                        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

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