Skip to content

Commit

Permalink
Update environment variable check
Browse files Browse the repository at this point in the history
  • Loading branch information
wkirby committed Feb 28, 2023
1 parent b37ad7e commit ee59f1e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/slayer/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def err(value: nil, status: :default, message: nil)
end

def err!(value: nil, status: :default, message: nil)
unless ENV[:SUPPRESS_SLAYER_WARNINGS]
unless ENV['SUPPRESS_SLAYER_WARNINGS']
warn '[DEPRECATION] `err!` is deprecated. Please use `return err` instead.'
end
raise ResultFailureError, err(value: value, status: status, message: message)
Expand Down
14 changes: 7 additions & 7 deletions lib/slayer/compat/compat_040.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ 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]
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]
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]
unless ENV['SUPPRESS_SLAYER_WARNINGS']
warn '[DEPRECATION] `flunk!` is deprecated. Please use `return err` instead.'
end
err!(value: value, status: status, message: message)
Expand All @@ -28,24 +28,24 @@ def flunk!(value: nil, status: :default, message: nil)

class Result
def success?
warn '[DEPRECATION] `success?` is deprecated. Please use `ok?` instead.' unless ENV[:SUPPRESS_SLAYER_WARNINGS]
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]
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]
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]
warn '[DEPRECATION] `fail` is deprecated. Please use `err` instead.' unless ENV['SUPPRESS_SLAYER_WARNINGS']
err(...)
end
end
Expand Down

0 comments on commit ee59f1e

Please sign in to comment.