Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Replace Kernel.warn with $stderr.puts

My project's rake task doesn't show warnings so just print directly to
stderr
  • Loading branch information...
commit fe41e242029a8987348eff6221dc44452a088949 1 parent 75eb75a
@sandro sandro authored
Showing with 4 additions and 3 deletions.
  1. +2 −1  lib/specjour/rsync_daemon.rb
  2. +2 −2 spec/rsync_daemon_spec.rb
View
3  lib/specjour/rsync_daemon.rb
@@ -58,11 +58,12 @@ def command
def check_config_version
File.read(config_file) =~ /\A# (\d+.\d+.\d+)/
if out_of_date? Regexp.last_match(1)
- Kernel.warn <<-WARN
+ $stderr.puts <<-WARN
Specjour has made changes to the way #{CONFIG_FILE_NAME} is generated.
Back up '#{config_file}'
and re-run the dispatcher to generate the new config file.
+
WARN
end
end
View
4 spec/rsync_daemon_spec.rb
@@ -65,13 +65,13 @@
describe "#check_config_version" do
it "warns when the version is out of date" do
stub(File).read { "# 0.0.0\n" }
- mock(Kernel).warn(/made changes/)
+ mock($stderr).puts(/made changes/)
subject.send(:check_config_version)
end
it "doesn't warn when the version isn't out of date" do
stub(File).read { "# #{Specjour::RsyncDaemon::CONFIG_VERSION}\n" }
- dont_allow(Kernel).warn
+ dont_allow($stderr).puts
subject.send(:check_config_version)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.