Sha256: fca11a2a6baf9a27dadda5e632f29c16851e78d683f5a4df5096d7e9665c4316

Contents?: true

Size: 896 Bytes

Versions: 4

Compression:

Stored size: 896 Bytes

Contents

# frozen_string_literal: true

require "rails/generators/named_base"

module Minitest
  module Generators
    class Base < ::Rails::Generators::NamedBase # :nodoc:
      class_option :spec, type: :boolean, default: true,
                          desc: "Use Minitest::Spec DSL"
      class_option :spec_expectation_monad, type: :string, default: "value",
                                            desc: "Spec DSL's expectation value mondad (options: value, expect, _)"

      def self.default_source_root
        File.expand_path(File.join(File.dirname(__FILE__), "minitest", generator_name, "templates"))
      end

      def test_file_type
        return "spec" if options[:spec]

        "test"
      end

      def spec_expectation_monad
        monad = options[:spec_expectation_monad]
        return monad if %w[value expect _].include? monad

        "value"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
minitest-rails-7.1.1 lib/generators/minitest.rb
minitest-rails-7.0.1 lib/generators/minitest.rb
minitest-rails-7.1.0 lib/generators/minitest.rb
minitest-rails-7.0.0 lib/generators/minitest.rb