Sha256: 1f26a2f8a6495812d54525c9f8f8f3101640a45d65263395054c807b61474d13

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

# :nocov:

module Slayer
  class Command
    class << self
      def pass(value: nil, status: :default, message: nil)
        warn '[DEPRECATION] `pass` is deprecated.  Please use `ok` instead.' unless ENV['SUPPRESS_SLAYER_WARNINGS']
        ok(value: value, status: status, message: message)
      end

      def flunk(value: nil, status: :default, message: nil)
        warn '[DEPRECATION] `flunk` is deprecated.  Please use `err` instead.' unless ENV['SUPPRESS_SLAYER_WARNINGS']
        err(value: value, status: status, message: message)
      end

      def flunk!(value: nil, status: :default, message: nil)
        unless ENV['SUPPRESS_SLAYER_WARNINGS']
          warn '[DEPRECATION] `flunk!` is deprecated.  Please use `return err` instead.'
        end
        err!(value: value, status: status, message: message)
      end
    end

    alias pass ok
    alias flunk err
    alias flunk! err!
  end

  class Result
    def success?
      warn '[DEPRECATION] `success?` is deprecated.  Please use `ok?` instead.' unless ENV['SUPPRESS_SLAYER_WARNINGS']
      ok?
    end

    def failure?
      warn '[DEPRECATION] `failure?` is deprecated.  Please use `err?` instead.' unless ENV['SUPPRESS_SLAYER_WARNINGS']
      err?
    end
  end

  class ResultMatcher
    def pass(...)
      warn '[DEPRECATION] `pass` is deprecated.  Please use `ok` instead.' unless ENV['SUPPRESS_SLAYER_WARNINGS']
      ok(...)
    end

    def fail(...)
      warn '[DEPRECATION] `fail` is deprecated.  Please use `err` instead.' unless ENV['SUPPRESS_SLAYER_WARNINGS']
      err(...)
    end
  end
end

# :nocov:

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slayer-0.5.4 lib/slayer/compat/compat_040.rb
slayer-0.5.3 lib/slayer/compat/compat_040.rb