mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Fix cucumber puts
deprecation warnings (#2075)
Cucumber has deprecated `puts` in favor of `log` for logging messages to the current cucumber formatter. In our case we actually want it both ways: we want to log messages using the cucumber formatter when cucumber is running, but use `Kernel#puts` otherwise. So, use `respond_to?` to see if cucumber's `log` is available, and if not, fall back to `puts`.
This commit is contained in:
parent
1c277895c9
commit
b83a39bd86
1 changed files with 6 additions and 0 deletions
|
@ -30,6 +30,12 @@ module VagrantHelpers
|
||||||
return [stdout, stderr] if status.success?
|
return [stdout, stderr] if status.success?
|
||||||
raise VagrantSSHCommandError, status
|
raise VagrantSSHCommandError, status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def puts(message)
|
||||||
|
# Attach log messages to the current cucumber feature (`log`),
|
||||||
|
# or simply puts to the console (`super`) if we are outside of cucumber.
|
||||||
|
respond_to?(:log) ? log(message) : super(message)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
World(VagrantHelpers)
|
World(VagrantHelpers)
|
||||||
|
|
Loading…
Reference in a new issue