Sha256: 2f3160b2a3e59bcd7fe70fad8ca24745ddc28c6adc28ec1579ab2b069feac651
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
require 'hanami/hanamirc' module Hanami # @api private module Generators # @api private class TestFramework # @api private RSPEC = 'rspec'.freeze # @api private MINITEST = 'minitest'.freeze # @api private VALID_FRAMEWORKS = [MINITEST, RSPEC].freeze # @api private attr_reader :framework # @api private def initialize(hanamirc, framework) @framework = (framework || hanamirc.options.fetch(:test)) assert_framework! end # @api private def rspec? framework == RSPEC end # @api private def minitest? framework == MINITEST end private # @api private def assert_framework! if !supported_framework? warn "`#{framework}' is not a valid test framework. Please use one of: #{valid_test_frameworks.join(', ')}" exit(1) end end # @api private def valid_test_frameworks VALID_FRAMEWORKS.map { |name| "`#{name}'"} end # @api private def supported_framework? VALID_FRAMEWORKS.include?(framework) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-1.0.0 | lib/hanami/generators/test_framework.rb |
hanami-1.0.0.rc1 | lib/hanami/generators/test_framework.rb |
hanami-1.0.0.beta3 | lib/hanami/generators/test_framework.rb |