Class: Hanami::RSpec::Commands::Generate::Action Private

Inherits:
CLI::Commands::App::Command
  • Object
show all
Defined in:
lib/hanami/rspec/commands.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0

Instance Method Summary collapse

Instance Method Details

#call(options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/hanami/rspec/commands.rb', line 131

def call(options, **)
  # FIXME: dry-cli kwargs aren't correctly forwarded in Ruby 3

  return if options[:skip_tests]

  slice = inflector.underscore(Shellwords.shellescape(options[:slice])) if options[:slice]
  key = inflector.underscore(Shellwords.shellescape(options[:name]))

  namespace = slice ? inflector.camelize(slice) : app.namespace
  base_path = slice ? "spec/slices/#{slice}" : "spec"

  generator = Generators::Action.new(fs:, inflector:)
  generator.call(key:, namespace:, base_path:)
end