HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-2.5.9/spec/mspec/lib/mspec/guards/feature.rb
require 'mspec/guards/guard'

class FeatureGuard < SpecGuard
  def self.enabled?(*features)
    new(*features).match?
  end

  def match?
    @parameters.all? { |f| MSpec.feature_enabled? f }
  end
end

# Provides better documentation in the specs by
# naming sets of features that work together as
# a whole. Examples include :encoding, :fiber,
# :continuation, :fork.
#
# Usage example:
#
#   with_feature :encoding do
#     # specs for a method that provides aspects
#     # of the encoding feature
#   end
#
# Multiple features must all be enabled for the
# guard to run:
#
#   with_feature :one, :two do
#     # these specs will run if features :one AND
#     # :two are enabled.
#   end
#
# The implementation must explicitly enable a feature
# by adding code like the following to the .mspec
# configuration file:
#
#   MSpec.enable_feature :encoding
#
def with_feature(*features, &block)
  FeatureGuard.new(*features).run_if(:with_feature, &block)
end