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-3.0.2/spec/mspec/lib/mspec/matchers/base.rb
module MSpecMatchers
end

class MSpecEnv
  include MSpecMatchers
end

# Expectations are sometimes used in a module body
class Module
  include MSpecMatchers
end

class SpecPositiveOperatorMatcher < BasicObject
  def initialize(actual)
    @actual = actual
  end

  def ==(expected)
    method_missing(:==, expected)
  end

  def !=(expected)
    method_missing(:!=, expected)
  end

  def equal?(expected)
    method_missing(:equal?, expected)
  end

  def method_missing(name, *args, &block)
    result = @actual.__send__(name, *args, &block)
    unless result
      ::SpecExpectation.fail_predicate(@actual, name, args, block, result, "to be truthy")
    end
  end
end

class SpecNegativeOperatorMatcher < BasicObject
  def initialize(actual)
    @actual = actual
  end

  def ==(expected)
    method_missing(:==, expected)
  end

  def !=(expected)
    method_missing(:!=, expected)
  end

  def equal?(expected)
    method_missing(:equal?, expected)
  end

  def method_missing(name, *args, &block)
    result = @actual.__send__(name, *args, &block)
    if result
      ::SpecExpectation.fail_predicate(@actual, name, args, block, result, "to be falsy")
    end
  end
end